Skip to content

Instantly share code, notes, and snippets.

@heartshare
Forked from nojimage/proc_check.sh
Created March 11, 2013 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heartshare/5136242 to your computer and use it in GitHub Desktop.
Save heartshare/5136242 to your computer and use it in GitHub Desktop.
#!/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