Quote:
Originally Posted by andrewcrawford
if ps ax
|
The outcome of this does not automagically make a process a service...
Quote:
Originally Posted by andrewcrawford
echo "$SERVICE is running"
|
This variable wasn't declared as in 'SERVICE=$1'.
Quote:
Originally Posted by andrewcrawford
if ps ax | grep -v grep | grep -w $1 > /dev/null
|
On GNU/Linux you may want to use 'pgrep' instead.
Quote:
Originally Posted by andrewcrawford
echo "$SERVICE is not running!" | mail -s "$SERVICE down" root
|
Are you sure you want to reinvent the wheel and not use something like 'monit'?