[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/misc/irc/ -> restart.php (source)

   1  <?php
   2  require_once(dirname(__FILE__) . '/../../init.php');
   3  require_once (APP_INC_PATH . "class.auth.php");
   4  require_once (APP_INC_PATH . "class.lock.php");
   5  require_once (APP_INC_PATH . "db_access.php");
   6  
   7  Auth::checkAuthentication(APP_COOKIE);
   8  
   9  if (Auth::getCurrentRole() < User::getRoleID("Developer")) {
  10      echo "Invalid role";exit;
  11  }
  12  
  13  $process_id = Lock::getProcessID('irc_bot');
  14  echo "Existing process ID: $process_id<br />\n";
  15  if (!empty($process_id)) {
  16      // kill current process
  17      $kill = `kill $process_id`;
  18      if (!empty($kill)) {
  19          echo "Killed: $kill<br />\n";
  20      }
  21  }
  22  
  23  Lock::release('irc_bot');
  24  $start = `cd /var/www/html/eventum/misc/irc/;php bot.php > /dev/null &`;
  25  if (!empty($start)) {
  26      echo "Error: $start<br />\n";
  27  }
  28  
  29  ?>
  30  <hr>
  31  If there are no error messages above, the bot should have been successfully restarted.


Generated: Wed Dec 19 21:21:33 2007 Cross-referenced by PHPXref 0.7