Bash Script: Check service and auto start if needed

If you are running a service and for some reason the service gets broken, you will want it to automatically restart. For that reason, I have created a script as below. Feel free to amend the array autoservice as needed because in my case it is monitoring mysqld, cherokee and squid.

#Add values to the array autoservice seperated by spaces
autoservice=(mysqld cherokee squid)

#the code
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
for i in “${autoservice[@]}”
service $i status # > /dev/null
if [ $? -eq 0 ]; then
echo $i “Running..”
service $i restart

Created in /scripts/, you need to chmod 777 the file and add it to crontab to run every 5minutes via the following:


chmod 777 /scripts/


crontab -e

add this line to run it every 5 mintues

*/5     *       *       *       *       sh /scripts/

Read More

Cherokee Web Server

I ran across Cherokee Web Server last week and I can say that this might take over Apache in some time.

Cherokee Web Server Logo

Installation and Configuration was pretty easy on my CentOS vps. A good guide to follow if you are also a linode user would be which automates the installation of a postfix,dovecot and cherokee web server. Installation was so simple and fast that I was done with it in under 15minutes.

This website currently runs on cherokee web server.

Try it if you have time : )

Read More