hgg/crond

管理 /etc/cron.d 中的 crontab 文件

v1.2.0 2013-04-03 19:31 UTC

This package is not auto-updated.

Last update: 2024-09-14 13:33:38 UTC


README

用于管理 /etc/cron.d 中小 crontab 文件的简单库。

安装

使用 Composer

{
    "require": {
        "hglattergotz/crond": "*"
    }
}

用法

<?php
use HGG\Crond\Job;
use HGG\Crond\Crond;

$job = new Job();
$job->setUser('root');
$job->setCmd('/path/to/do/something/awesome');
$job->setTime('0 * * * *');
$job->setFileName('myCronJob');

$cron = new Crond();
$cron->install($job);

以上命令将在以下位置的文件中安装 cron 任务:

0 * * * * root /path/to/do/something/awesome

位于

/etc/cron.d/myCronJob