Esempio n. 1
0
 public function handleCommand($data)
 {
     /*{{{*/
     $ret = true;
     switch ($data['command']) {
         case 'stop':
             $pid = (int) file_get_contents($this->pid_file);
             if ($pid) {
                 $ret = posix_kill($pid, SIGTERM);
             }
             break;
         case 'exec':
             $command_list = $data['option'];
             foreach ($command_list as $command) {
                 $ret = CronShell::execute($command);
                 $message[] = array($command => $ret);
             }
             CronLogger::message(array('type' => 'host-cmd', 'host' => $data['host'], 'user' => $data['user'], 'time' => time(), 'message' => $message));
             break;
     }
 }
Esempio n. 2
0
 public function report()
 {
     /*{{{*/
     CronLogger::info(json_encode($this->last_execute_info));
     CronLogger::message(array('type' => 'task-run', 'id' => $this->id, 'user' => $this->user, 'time' => time(), 'result' => $this->last_execute_info));
 }