[plug] results in variable

Craig Ringer craig at postnewspapers.com.au
Sun Aug 24 21:41:23 WST 2003


> Perhaps you could try pgrep (available in the 'procps' package for
> Linux). For instance: `pgrep -U postfix > /dev/null` will exit with a
> return code of 0 if there are postfix processes or 1 if there are none.
> So, you can then check the value of the $? variable -- if it is zero
> then postfix is running, otherwise postfix is not.

'killall -0 postfix' and testing the exit value should work. A signal 
zero should be ignored by the application - it's just used to see if you 
/can/ send a signal.

The process may or may not actually be named postfix - I can't remember 
right now what postfix calls it, but I don't think it's 'postfix'.

Nonetheless, just using killall (or pkill, which will do the same job) 
will do the trick.

Craig Ringer



More information about the plug mailing list