Published on

Service restart script

Authors

For when just restarting everything is more expedient than figuring out what's really going on (i.e. don't do this) :

bash
# more services.web.restart
# This is an alternative to :
# run_count=`ps eax | grep ${process} | grep -v grep | wc -l`

if [ ! "$(pidof mysqld)" ]; then
	service mysqld restart
fi

if [ ! "$(pidof php-cgi)" ]; then
	service php-cgi restart
fi

if [ ! "$(pidof uwsgi)" ]; then
	/etc/init.d/uwsgi stop
	/etc/init.d/uwsgi start
fi

if [ ! "$(pidof nginx)" ]; then
	service nginx restart
fi