File: README.md

Recommend this page to a friend!
  Classes of Dmitry Mamontov  >  PHP Cron Manager Class  >  README.md  >  Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP Cron Manager Class
Run scheduled tasks defined in a crontab file
Author: By
Last change:
Date: 6 years ago
Size: 1,278 bytes
 

Contents

Class file image Download

PHPCron

PHPCron is a daemon to run tasks scheduled cron written in php, works similar to crontab

Requirements

  • PHP version 5.1 or higher.
  • Module installed "pcntl" and "posix".
  • All functions "pcntl" and "posix" removed from the directive "disable_functions".

Installation

Download the archive and extract.

wget https://github.com/dmamontov/crondaemon/archive/master.zip
unzip master.zip

or

git-clone https://github.com/dmamontov/crondaemon.git

Copy the folder "src" to the root of your project.

Entries cron

Create an entry in the file tasks/main.cron analogously to Example

/2  * php /var/www/data/public/cron/test.php test1
/5  * php /var/www/data/public/cron/test.php test2

More information about cron entry can be found here

Running the daemon

To start the daemon requires the console to run the script:

php /path/to/crondaemon.php parameter

or

/path/to/crondaemon parameter

Valid parameters

  • start [-f]
  • stop
  • restart
  • status
  • help

Connecting and starting the demon in your code

require_once 'lib/Autoloader.php';
Autoloader::register();
$cron = new CronDaemon($argv);
$cron->run();

For more information send a message to info at phpclasses dot org.