예제 #1
0
파일: task.php 프로젝트: sdgdsffdsfff/xcron
 public function run()
 {
     /*{{{*/
     if ($this->changeToRunningUser()) {
         $this->last_execute_info = CronShell::execute($this->command);
     }
 }
예제 #2
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;
     }
 }
예제 #3
0
<?php

include '../src/shell.php';
$cmd = $argv[1];
$retval = CronShell::execute($cmd);
print_r($retval);