On 9/21/07, Alex Hewitt <[EMAIL PROTECTED]> wrote:
> One simple way 'ps aux | grep myjob'

  A slightly improved version might be:

ps -C myjob -o pid,start,time,vsz,rss,cmd

  In the above, "myjob" has to be the actual executable file name.
Sometimes that's not what you might expect; it depends on how the job
is invoked.  But the advantage of using "-C" is that it won't find
anything else; the "grep" method has a tendency to pick up other
processes (including the grep itself).

  The "-o" business just selects the output fields.  PID, wall clock
start time, CPU time used, virtual segment size, resident set size,
and command are the ones I expect might be useful for this.  See "man
ps" for all the possible fields (lots!).

  Then run that as a parallel cron job that starts at the same time
and logs the process periodically.  For example, in your crontab:

# run "myjob" every night at 2:00 AM
00 02 * * * $HOME/bin/myjob
# monitor myjob for from 2 AM to 2:30 AM, every two minutes
0-30/2 02 * * * ps --no-header -C myjob -o pid,start,time,vsz,rss,cmd
> $HOME/myjob.pslog

  (Note: Syntax in the above not checked.  Testing is advised.)

-- Ben
_______________________________________________
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/

Reply via email to