PHPCron is a daemon to run tasks scheduled cron written in php, works similar to crontab
- PHP version 5.1 or higher.
- Module installed "pcntl" and "posix".
- All functions "pcntl" and "posix" removed from the directive "disable_functions".
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.
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
To start the daemon requires the console to run the script:
php /path/to/crondaemon.php parameter
or
/path/to/crondaemon parameter
- start [-f]
- stop
- restart
- status
- help
require_once 'lib/Autoloader.php';
Autoloader::register();
$cron = new CronDaemon($argv);
$cron->run();