Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Run the php file every minute, and inside this script, already determine whether it is time for it to run. Get the most correct and safe option.
Edit /etc/crontab.
From a security point of view, it's a huge hole to give PHP access to this file.
//получаем список работ для пользователя user
$currentJobs = shell_exec("crontab -u user -l");
//вносим нужные изменения в расписание работ
...
//сохраняем все во временном файле
$filename = tempnam(sys_get_temp_dir(), 'crontab');
file_put_contents($filename, $currentJobs);
//обновляем cron
exec("crontab -u user " . $filename);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question