Register

Closed Thread

MikeG@Spry
Guest

Posts: n/a
 
10-27-2007, 04:39 AM
Default Automagically restart httpd without your intervention!

Okay now in your /root (or whever you want it) directory we're going to create a file:

Code:
touch automagic.sh
Now mark it executable
Code:
chmod +x automagic.sh
Now open it up with vi or nano or mc or whatever text editor you use, and make it look like this:

Code:
#!/bin/bash
#automagic.sh - Automagically restart httpd if it dies!
netstat -l | grep http | wc -l | awk '{if ($1 == 0)  system("service httpd restart") }'
Save it.

Now open up your crontab:

Code:
crontab -e
Go to the last line, and add this:
Code:
0-59/1 * * * * /root/automagic.sh
Now your system will check once per minute if httpd is actually working, and if not, restart the process for you!
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 08:59 PM. Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 VBulletin Skin by ForumMonkeys.