This script is able to execute scripts, like crontab. But more often.
Please note that this script is under development.
Create log
folder for log files.
Create tasks.json
file to describe tasks. For example:
[
{
"exec": "php /var/www/cron-test/task1.php",
"secs": 1,
"log": "/var/log/php-cron/one.log",
"report": "john@doe.com,jane@doe.com"
},
{
"exec": "php /var/www/cron-test/task2.php",
"secs": 3
}
]
exec
: Command to execute
secs
: Number of seconds between runs
log
(optional): Log file name with full path
report
(optional): Comma separated email address list to receive task output
It's up to you, run simply in a un*x screen is an option.
Upstream is an other option. This is just an example for more details please do some research.
For example In CentOS 6 create /etc/init/php-cron.conf
with content below:
start on filesystem or runlevel [2345]
stop on shutdown
exec php /var/www/php-cron/index.php
respawn
Update exec php
with your current path.
Find and add missing features, create proper documentation, etc :)