Site Tools


one_off_reboot

This is an old revision of the document!


One-off reboot (or any command really...)

What if you wanted to perform, for example, a restart of your hardware device? However, you might not want to perform that action until a certain time, such as when users stop needing Internet connectivity, or until some other condition is met.

You might have noticed the option under Administration/Scheduler to reboot at a specific time. This is a periodic setting only, and will be saved in the device's configuration settings. A reboot at 5:00 AM might be executed more frequently than you might want.

A simple solution to this is to have a reboot performed only once. FreshTomato includes a minified version of the Linux crontable command, called “cru”.

The above can be done by adding a command directly into the crontable.

For example:

cru a reboot-one-off "0 5 * * * /sbin/reboot"


This command would restart your device at 5:00 AM. The standard Unix cron syntax is used here:
cron

This is effective on a running device, but not saved permanently anywhere in the configuration. Thus, after reboot the scheduled activity will automatically disappear, which is what is wanted in this case.

If you need to remove the scheduled activity for whatever reason, before it is executed, use the following command:

cru d reboot-one-off


to verify use the “l” parameter to list scheduled cron jobs:

cru l
one_off_reboot.1630173629.txt.gz · Last modified: 2021/08/28 19:00 by hogwild