Results 1 to 2 of 2
  1. #1

    * Neep help in adding "killall - 9 httpd" to my cron. Please advice urgently

    Hey guys I've this php running in cron, to check httpd down status and start it again. The problem is sometimes It wouldn't start unless i use the killall manually..

     class monitor {
     function httpUp() {
      $status = shell_exec("/etc/init.d/httpd status");
      if (preg_match("#is running#",$status)) { 
       return true;
      } else {
       return false;
     function restartHttp() {
      shell_exec("/etc/init.d/httpd start");
     function writeLog($message) {
      $s = sprintf("[%s] %s\n",date("d-m-y g:i a"),$message);
     $monitor = new monitor();
     if ($monitor->httpUp()) {
     $monitor->writeLog("httpd already running");
    } else {
     $monitor->writeLog("httpd is down");
     $monitor->writeLog("httpd has been started");
    The log file goes like this
    [16-11-09 3:00 pm] httpd already running
    [16-11-09 3:11 pm] httpd already running
    [16-11-09 3:20 pm] httpd is down

    [16-11-09 3:20 pm] httpd has been started

    Can someone edit the script for me and add "killall - 9 httpd" right before it start the httpd? And so the log will look like this:

    httpd is down

    Processes have been killed
    httpd has been started

  2. #2
    Join Date
    Jun 2008
    if it needs to run the killall -9 then why u believe httpd is down?

Similar Threads

  1. How efficient are topic titles like "BLOWOUT", "SPECIAL" and "KILLER OFFER"?
    By BluewaveHosted in forum Running a Web Hosting Business
    Replies: 18
    Last Post: 06-30-2009, 11:21 AM
  2. [cPanel]: "httpd not running, trying to start" and "httpd could not be started"
    By KamilPRO in forum Hosting Security and Technology
    Replies: 7
    Last Post: 09-01-2007, 08:33 PM
  3. Adding multiple Physical servers to "Modern bill" & "WHM Autopilot" it p
    By j4son in forum Hosting Software and Control Panels
    Replies: 2
    Last Post: 10-12-2004, 04:23 PM
  4. Cron emails: "/bin/bash: root: command not found"
    By xtend in forum Dedicated Server
    Replies: 1
    Last Post: 07-20-2004, 03:37 PM
  5. should i install package "redhat-config-httpd"?
    By torwill in forum Hosting Security and Technology
    Replies: 1
    Last Post: 08-04-2003, 05:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts