11337 questions

13512 answers

21172 comments

31662 members

0 votes
900 views 0 comments
by
/etc/crontabs/root "path not in backup file" Latest FW* RUT9XX_R_00.05.02.2 2018.10.12

backup and restore cronjob isn't possible.

1 Answer

0 votes
by

Hello,

This is correct. The Backup file doesn't contain cronjobs. It will only save cronjobs that are related to services configured from the WebUI. For example, when you configure Periodic Reboot, every time the service starts it creates a cronjob based on the Periodic Reboot config file. So because configs are saved in a Backup file, cronjobs related to these configs still exist after a Backup file is uploaded.

If you configure custom cronjobs and want them to be saved in a Backup file, I recommend using User Scripts to add your cronjobs. You can enter User Scripts via the WebUI, System → User Scripts page or by editing the /etc/rc.local file.

An example script would look like this:

crontab -r
echo "0 0 * * * reboot" >> /etc/crontabs/root

The first file removes existing cronjob so that they don't start duplicating on each router restart, the second line adds a new job.

It is also important to mention that if you use it this way, the cronjobs generated from config files will no longer work (because of the first line). So if you have configured any crontab related services, insert service restart lines after the first line of the script. For example, if you configured Periodic Reboot in the WebU, add a line that restarts the service (this will generate the related cronjobs):

crontab -r
/etc/init.d/periodic_reboot restart
echo "0 0 * * * reboot" >> /etc/crontabs/root

More on User Scripts: https://wiki.teltonika.lt/index.php?title=User_Scripts

More on crontabs: https://wiki.teltonika.lt/index.php?title=Crontabs

Best answer