Oct
23
2009
Uncategorized

Automatic Server Restart in linux.

In windows , if the server shutdown or crashed ,it will automatically restart , if we installed apache as service.

But i linux server we needs to write a shell program to do this.

#!/bin/bash
if [ ‘ps -waux | grep -v grep | grep -c httpd’ -lt 1
]; then apachectl restart; fi

By using the above script we can able to achive this.

1. We needs to give executable permission for the script and we needs to add this script in cron configuration.

Like this we can also able to send a notification  , when the server shutdown.

About the Author:

Leave a comment

 

October 2009
M T W T F S S
    Jul »
 1234
567891011
12131415161718
19202122232425
262728293031  
  Domain Name + 1GB Linux India Web Hosting in Rs.349