![]() | ||
|
|
Random Nonsense / Geek Stuff All those random tech ramblings you can't fit anywhere else! |
![]() |
Thread Tools |
![]() |
#1 |
The Pro/Life Support System
Join Date: Dec 1999
Location: Denver, CO
Posts: 4,041
|
![]()
OK what i basicly need done, is something to monitor the httpd service on an hourly basis.
Basically I need it to do a “/sbin/service httpd status” and if the response is “httpd is stopped...” then run a “/sbin/service httpd start” I am a dumbshit when it comes to writing my own scripts ( I can edit other people stuff rather easily though ![]() There is a glitch with php, and the management software on the server that causes the HTTPD service to get all confused durring a graceful restart. ( cause it attempts multiple restarts at once and .. well that doesn't work) Any help would be appreciated!!!
__________________
Joe - I only take this hat off for one thing... ProCooling archive curator and dusty skeleton. |
![]() |
![]() |
![]() |
#2 |
Cooling Savant
Join Date: Aug 2001
Location: Chippewa Falls, Wisconsin
Posts: 294
|
![]()
put this in cron:
*/10 * * * * root perl /pathToTheScript/httpdwatch.pl And here's the script: #!/usr/bin/perl #================================================= =================httpdwatch.pl # Objective: Periodically check in on httpd and start if necessary # Inputs: None # Outputs: None # History: # Programmer: Date: Modification: # -------------- ---------- ------------------------------------------------- # Rob Burgess 10/02/2002 Original version #================================================= ============================== open(serviceStatus, "/sbin/service httpd status|"); $httpdStatus=<serviceStatus>; chomp $httpdStatus; close(serviceStatus); if( $httpdStatus =~ /stopped/ ){ system("/sbin/service httpd start&"); } elsif( $httpdStatus =~ /running/ ){#OK so far... } else{ print("Something is very wrong...(httpdwatch.pl)\n"); }#==============================EOF=============== =============================== #edit: made some readability improvements #edit: and a syntax error fix :| Last edited by Arcturius; 10-02-2002 at 11:54 AM. |
![]() |
![]() |
![]() |
#3 |
The Pro/Life Support System
Join Date: Dec 1999
Location: Denver, CO
Posts: 4,041
|
![]()
awesome I will try it out tonight!!! thanks!!
__________________
Joe - I only take this hat off for one thing... ProCooling archive curator and dusty skeleton. |
![]() |
![]() |
![]() |
#4 |
Cooling Savant
Join Date: Aug 2001
Location: Chippewa Falls, Wisconsin
Posts: 294
|
![]()
Oh, BTW, the above will run the script every 10m, but being what your occupation is, I'm sure you knew that.
![]() Have fun! |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|