[plug] results in variable

Jon Miller jlmiller at mmtnetworks.com.au
Sun Aug 24 21:16:46 WST 2003


Need some help in obtaining the correct results in a variable in a script.
Since postfix (v1.1.9) does not contain a status parameter, running service postfix status only yields:
gateway:~# service postfix status
postfix: unrecognized service
while running the following yields:
gateway:~# /usr/sbin/postfix status
postfix/postfix-script: fatal: usage: postfix start (or stop, reload, abort, flush, or check)

So my question is in a script I need to check if postfix is running, manually I issue the following:
ps aux | grep -i postfix and I get various lines:
gateway:~# ps aux | grep -i postfix
postfix  28516  0.0  0.9  3796 1220 ?        S    13:55   0:15 qmgr -l -t fifo -
postfix  29895  0.0  0.7  2428  924 ?        S    20:52   0:00 pickup -l -t fifo
postfix  29947  0.0  0.6  2412  884 ?        S    21:08   0:00 flush -t unix -u
root     29949  0.0  0.4  1704  580 pts/6    S    21:08   0:00 grep -i postfix

While this is good for a manual check is there any way of getting some type of information on the running status of postfix into a variable?  
I'm looking at trying to either assign a variable a simple "0" or "1" or 'running' or 'down' as an end product of the variable.
Is there a way to check that a variable has a value and if so assign it either "1" or "running" vs if there is no value assign it a "0" or "down" value.

Thanks


Jon L. Miller, MCNE, CNS
Director/Sr Systems Consultant
MMT Networks Pty Ltd
http://www.mmtnetworks.com.au

"I don't know the key to success, but the key to failure
 is trying to please everybody." -Bill Cosby






More information about the plug mailing list