Thursday, March 22, 2007

Is that process running?

Did you know you can query a process directly by pid and without grep?

I didn't.

ps -p `cat pidfile` -o args=

Returns something like

perl assp.pl


Is it running? Yes. Is it running the same thing as it's supposed to run? Yes.
An explanation:
ps show processes
-p show process of a specific id
`cat pidfile` the ` "backticks" mean to execute what's in between them and use it in the command line as text. cat means the same thing as type in Windows: output the contents of the file. pidfile is the filename that holds the pid/process ID of the application that's running.
-o show only what I want to show
args= show the full execution line of the process. The = is to give a column name to the "args" column. If you specify no column name, it doesn't list one.

No comments:

Blog Archive