Created
August 10, 2011 04:15
-
-
Save nojimage/1136109 to your computer and use it in GitHub Desktop.
お名前VPSがプロセスを勝手にKILLしてくれるのでcronで簡易プロセス監視
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SERVICES=('zabbix_agentd' 'sshd' 'denyhosts' 'httpd' 'mysqld' 'postfix' 'amavisd') | |
for service in ${SERVICES[@]}; do | |
proc_count=`ps ax | grep -v 'grep' | grep -c "$service" 2>/dev/null` | |
if [ $proc_count -eq 0 ]; then | |
echo "start ${service}..." | |
/etc/init.d/${service} start | |
fi; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment