Best way to check that a process is running on a Unix system?
BJörn Lindqvist
bjourne at gmail.com
Sun May 28 01:20:20 EDT 2006
> What is the best way to check that a process is running (or better yet
> number of instances) based on the name of the process? Would have to
> work on a unix/linux system.
Use "ps -C proc_name". Then either read the nr of lines in the output
(for the number of instances) or read the return value. 0 if the
process is running. Or read the /proc/*/status files and check if your
process is in any of them.
--
mvh Björn
More information about the Python-list
mailing list