public function run() { /*{{{*/ if ($this->changeToRunningUser()) { $this->last_execute_info = CronShell::execute($this->command); } }
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; } }
<?php include '../src/shell.php'; $cmd = $argv[1]; $retval = CronShell::execute($cmd); print_r($retval);