Skip to content

Instantly share code, notes, and snippets.

@nojimage
Created August 10, 2011 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nojimage/1136109 to your computer and use it in GitHub Desktop.
Save nojimage/1136109 to your computer and use it in GitHub Desktop.
お名前VPSがプロセスを勝手にKILLしてくれるのでcronで簡易プロセス監視
#!/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