in reply to Re^2: Percent of CPU/Mem Usage for User
in thread Percent of CPU/Mem Usage for User

Response: Yes, the process would stay active, but isn't that what's needed, at least until the script ends, or the process is terminated? My guess would be to fork this check. I'm uncertain why there aren't any hooks already into the Linux kernel to do this... perhaps there are, afterall, I come from the MS world :)


Demize
  • Comment on Re^3: Percent of CPU/Mem Usage for User

Replies are listed 'Best First'.
Re^4: Percent of CPU/Mem Usage for User
by geekt (Novice) on Jun 14, 2010 at 17:03 UTC
    Well, if this script is being called only once, such as with a cron job, that's fine. However, if you were to put this into a CGI script, the number of processes or memory could quickly get out of control. You could add a check to see how many processes are running under the user. Then you could kill it (or something else that's cleaner) if there are too many processes, or too much memory is used. This might be the best of both worlds.