php - create cron job from another cron job -
good day all. need this:
- create cron job (no problem here)
- the cron executes php script
- if condition met need create cron using date returned script
i have root access , everything. os centos 5.5 (even thought don't think matters long crons supported)
to more specific need cron executes php script gets exact moment of time database (hours, minutes, seconds) when execute script. database can updated @ moment. first job executed once every 10 minutes.
you can create /etc/cron.d/generated
crontab file in script add generated entries.
file_put_contents('/etc/cron.d/generated', ' ... entry contents ...', file_append');
as suggested @the myyn in comment, at
may solution too, if want execute script once. in php invoke this:
system(sprintf('echo %s|at %s', escapeshellarg($command), escapeshellarg(date('h:i d.m.y', $timestamp)) );
or this:
$fd = popen(sprintf('at %s', escapeshellarg(date('h:i d.m.y', $timestamp))), 'w'); fwrite($fd, $command); pclose($fd);
Comments
Post a Comment