Phone: +65-8585-1750

Address: 30 Holland Close, Singapore

Service restart script

Fri, Oct 26, 2012 mdda OSS Blog Comments

Service restart script

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

# 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

blog comments powered by Disqus