|
|
Question : unix bash scripting - if statements
|
|
I'm having some trouble writing a bash script to monitor a service.
I was writing it like this.
num = ps aux | grep httpd | wc -l
if($num=0) restart_apache
It doesnt seem to work. Syntax errors. Can someone help me fix that?
FYI: restart_apache is script to just restart apache.
|
Answer : unix bash scripting - if statements
|
|
In a Bourne shell (sh or bash) script the syntax of the if statement would be:
if [ $num -eq 0 ]; then restart_apache fi
|
|
|
|