Skip to content
This repository
branch: master

This branch is 0 commits ahead and 0 commits behind master

Octocat-spinner-32 bin command line tool April 11, 2012
Octocat-spinner-32 src more unittests April 12, 2012
Octocat-spinner-32 tests clitool test April 12, 2012
Octocat-spinner-32 .gitignore tests cronentry 100% April 11, 2012
Octocat-spinner-32 .travis.yml travis M April 11, 2012
Octocat-spinner-32 typos fix in README April 13, 2012

PHP Crontab Manager

Last build status: Build Status

Manages linux crontab file by adding and deleting the appropriate entries. It is able to track the source file so that after the changes to this file, he will be able to enter and update the user's crontab file in safe way (doesn't remove entries added by user using crontab -e).


  • copy files to your project
  • include files from src directory or use some autoloader
  • use it as described below


If you are willing to use this tool as other user be sure enable appropriate entry into end of sudoers file (visudo) for ex.:

%developers ALL=(www-data)NOPASSWD:/usr/bin/crontab

Above means that users in a group developers can run program crontab as user www-data without need to enter the password.


Here is a simple example of use. Adding a simple task to crontab:

use php\manager\crontab\CrontabManager;

$crontab = new CrontabManager();
$job = $crontab->newJob();
$job->on('* * * * *');
$job->onMinute('20-30')->doJob("echo foo");
$job->onMinute('35-40')->doJob("echo bar");

A more complex example, but simpler to write. Adding and removing files to manage by the cron job. Files will be updated so as not to disrupt other tasks in the cron:

use php\manager\crontab\CrontabManager;

$crontab = new CrontabManager();

You can also use the built-in tools from the console: cronman located in the directory bin/ for ex.:

bin/cronman --enable /var/www/myproject/.cronfile --user www-data
Something went wrong with that request. Please try again.