Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:base-system:cron [2021/04/24 20:42] – [Command-line interface] bobafetthotmail | docs:guide-user:base-system:cron [2023/08/08 11:30] – Added my cronjob to keep last N snapshots of config torxgewinde | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Scheduling tasks ====== | + | ====== Scheduling tasks with cron ====== |
| {{section> | {{section> | ||
| ===== Introduction ===== | ===== Introduction ===== | ||
| - | * OpenWrt | + | * OpenWrt |
| - | * This how-to describes the methods | + | * This how-to describes the method |
| - | * See also [[docs: | + | * See also [[docs: |
| - | ===== Web interface ===== | + | ===== Goals ===== |
| + | * Run programs or scripts at a specific time. | ||
| + | * Automate scheduled task management. | ||
| + | |||
| + | ===== Web interface | ||
| Set up cron jobs using web interface. | Set up cron jobs using web interface. | ||
| - Navigate to **LuCI -> System -> Scheduled Tasks**. | - Navigate to **LuCI -> System -> Scheduled Tasks**. | ||
| - Edit the configuration and click the **Save** button. | - Edit the configuration and click the **Save** button. | ||
| - | ===== Command-line | + | ===== Command-line |
| Set up cron jobs using command-line interface. | Set up cron jobs using command-line interface. | ||
| Line 23: | Line 27: | ||
| # Apply changes | # Apply changes | ||
| - | service | + | / |
| </ | </ | ||
| This will edit the configuraion ''/ | This will edit the configuraion ''/ | ||
| - | :!: There should be a end-of-line | + | :!: There should be a EOL character on the last line of the crontab file. |
| Just leave an empty line at the end to be sure. | Just leave an empty line at the end to be sure. | ||
| Line 58: | Line 62: | ||
| If you set the day of the week to 7, BusyBox will go bonkers and run your command every day. | If you set the day of the week to 7, BusyBox will go bonkers and run your command every day. | ||
| - | Table of shortcuts: | + | **Table of shortcuts:** |
| ^ Shortcut ^ Equivalent ^ Description ^ | ^ Shortcut ^ Equivalent ^ Description ^ | ||
| - | | '' | ||
| | '' | | '' | ||
| | '' | | '' | ||
| Line 69: | Line 72: | ||
| | '' | | '' | ||
| | '' | | '' | ||
| + | |||
| + | :!: Time shortcuts are not enabled by default. Shortcuts require compiling busybox with FEATURE_CROND_SPECIAL_TIMES enabled in the busybox compile options. | ||
| ===== Troubleshooting ===== | ===== Troubleshooting ===== | ||
| Line 83: | Line 88: | ||
| * [[man> | * [[man> | ||
| * [[https:// | * [[https:// | ||
| - | * [[http:// | + | * [[http:// |
| ==== Periodic reboot ==== | ==== Periodic reboot ==== | ||
| Line 129: | Line 134: | ||
| 59 05 * * 1 / | 59 05 * * 1 / | ||
| # crontab must end with the last line as space or a comment | # crontab must end with the last line as space or a comment | ||
| + | </ | ||
| + | |||
| + | ==== Keep number of configs / snapshots of config ==== | ||
| + | To keep a number N of configurations/ | ||
| + | |||
| + | <code bash> | ||
| + | #Make a new backup/ | ||
| + | #01 00 * * * sysupgrade -b "/ | ||
| + | 01 00 * * * find "/ | ||
| </ | </ | ||