i am trying to write a script on my *test machine *to check if the process are running , and if they are not need to start them any idea why this is not working ??
#!/bin/sh -x SERVICES= `ls -la /etc/init.d/ |awk '{print $9 }' |sed -e 's/[^[:alnum:]]//g'`
for i in $SERVICES do if [ $(ps -aux|grep -v grep |grep $i |wc -l) != 0 ]; then . /etc/init.d/$i start else echo " the service $i is running " fi done