kfosoft/php-crontab-manager

There is no license information available for the latest version (v1.0) of this package.

PHP Crontab Manager

v1.0 2015-08-12 19:16 UTC

This package is not auto-updated.

Last update: 2024-04-27 15:15:19 UTC


README

Installation

Installation with Composer

Add in composer.json

    "require": {
        ...
        "kfosoft/php-crontab-manager":"1.0"
    }

Well done!

Methods

onMinute($minute) : Set minute or minutes.
onHour($hour) : Set hour or hours.
onDayOfMonth($dayOfMonth) : Set day of month or days of month.
onMonth($month) : Set month or months.
onDayOfWeek($dayOfWeek) : Set day of week or days of week.
on($timeCode) : Set entire time code with one function. This has to be a complete entry. See http://en.wikipedia.org/wiki/Cron#crontab_syntax
doJob($job) : Add job to the jobs array. Each time segment should be set before calling this method. The job should include the absolute path to the commands being used.
setCrontabPath($path) : location of the crontab executable. Default /usr/bin/crontab.
setDestinationPath($path) : location to save the crontab file.
activate($includeOldJobs = true) : Save the jobs to disk, remove existing cron.
clearJobs() : lear array jobs.
clearJobsFile() : Clear jobs file.
listJobs() : List current cron jobs.

Example

$crontab = new /kfosoft/helpers/CronTab();
$crontab->onMinute(10)->onHour(0)->doJob('echo "job is work." >> /home/user/test')->activate();

Enjoy, guys!