public __construct ( string $execution = null, null $name = null ) | ||
$execution | string | it can be a Runnable object, callback function or null |
$name | null | process name,you can manager the process by it's name. |
/** * @param ReaderInterface $reader * @param FilterInterface $filter * @param NotificationInterface $notify */ public function __construct(ReaderInterface $reader, FilterInterface $filter, NotificationInterface $notify) { parent::__construct(); $this->reader = $reader; $this->filter = $filter; $this->notify = $notify; $this->registerSignalHandler(SIGTERM, array($this, 'signalHandler')); }
/** * @param string $name * @param string $cmd * @param string $time * @param string|null $out * @param string|null $user * @param string|null $group * @param string|null $comment */ public function __construct($name, $cmd, $time, $out = null, $user = null, $group = null, $comment = null) { parent::__construct(); $this->name = $name; $this->cmd = $cmd; $this->time = $time; $this->out = $out; $this->user = $user; $this->group = $group; $this->comment = $comment; }
/** * @param string $name * @param string $cmd * @param string $time * @param LoggerInterface $out * @param LoggerInterface $err * @param string|null $user * @param string|null $group * @param string|null $comment */ public function __construct($name, $cmd, $time, LoggerInterface $out = null, LoggerInterface $err = null, $user = null, $group = null, $comment = null) { parent::__construct(); $this->name = $name; $this->cmd = $cmd; $this->time = $time; $this->user = $user; $this->group = $group; $this->comment = $comment; if (is_null($out)) { $this->out = new Logger(Crontab::NAME); $this->out->pushHandler(new NullHandler()); } else { $this->out = $out; } if (is_null($err)) { $this->err = new Logger(Crontab::NAME); $this->err->pushHandler(new NullHandler()); } else { $this->err = $err; } }