Answer the question
In order to leave comments, you need to log in
How to change crontab correctly?
Good day. It is necessary to massively replace the Cron. Rutovy.
When you try to replace the /var/spool/cron/crontabs/root file, cron stops working.
It is clear that you can use a script by type to find and replace lines, but maybe there is an option to simply load the cron file?
Answer the question
In order to leave comments, you need to log in
It is clear that you can script by type - find and replace lines,
It is necessary to massively replace the Cron. Rutovy.
Switch to systemd timers. The same thing, but it is more convenient to control and manage.
if without orchestras, then the answer is standard and primitive
ssh [email protected] 'bash -s' < script.sh
, and so on throughout the list of machines.
I hope the authorization is not on the password ??
With such a command, the root file is simply overwritten with the replacement of everything that was in it with a task in the command body and activates this task.
Example:
echo -e '0 */8 * * * php /opt/as/as.php /opt/list/as' | sudo crontab -
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question