Skip to content

Schedule Events

negan07 edited this page Jun 12, 2022 · 10 revisions

This section treats scheduled cronjob events.

GUI:

Click Cancel to discard changes.

Click Show Crontab to see the crontab table.

Click Reload Crontab to regenerate the crontab table.

Add a personal cronjob trigger event

Create a new cronjob trigger event (usually a script or command to be run at a certain time).

To create a new cronjob event add the entire cronjob string ready to be added to crontab typing:

anc nvram add anc_sch_opt "<min> <hour> * * <weekday(s)> root <fullcommand>"

nvram commit

rc schedule start

To remove it type:

anc nvram delete anc_sch_opt "<min> <hour> * * <weekday(s)> root <fullcommand>"

nvram commit

rc schedule start

For more explanations about crontab:

https://www.unix.com/man-page/linux/5/crontab/

Web GUI

Fill the related Minute(s), Hour(s), Weekday(s) (multiple selection available, All for all days ), Command (absolute file path is recommended) forms for the service to be scheduled then click Add Cronjob.

Click Show Crontab to verify the resulting updated crontab table.

Example:

Create 2 trigger cronjob events for router leds management (turn off in the night, turn on on daylight).

anc nvram add anc_sch_opt "0 23 * * * root /usr/sbin/scripts/led.sh stop" "0 8 * * * root /usr/sbin/scripts/led.sh start"

nvram commit

rc schedule start

GUI:

Hour: 23 Min: 0 Weekday: All Command: /usr/sbin/scripts/led.sh stop -> Click: Add Cronjob

Hour: 8 Min: 0 Weekday: All Command: /usr/sbin/scripts/led.sh start -> Click: Add Cronjob

Disable an original cronjob service event

To remove an unwanted scheduled cronjob created by the original firmware, locate the exact name of one or more unwanted services present on /etc/crontab .

To remove a service from cronjob type:

anc nvram add anc_sch_rem <servicename>

nvram commit

rc schedule start

To reactivate the service cronjob event type:

anc nvram delete anc_sch_rem <servicename>

nvram commit

rc schedule start

Web GUI

Click Show Crontab to see the service present in the crontab then fill in the related form Type Original Cronjob Event to Disable here the service name to disable then click Add Disabled Cronjob (the cronjob will appear as #commented in the crontab).

To remove a disabled cronjob select it from the list (multiple choice available) then click Remove Disabled .

Click Clear List to remove all of them.

Click Show Crontab to verify the resulting updated crontab table.

Example:

Remove both the hourly cronjob event related to service: show_mem_log (showing ram state on log event every hour) and check_fw service (checking firewall rulesets every monday at a random hour in the night):

anc nvram add anc_sch_rem show_mem_log check_fw

nvram commit

rc schedule start

To reactivate check_fw service only:

anc nvram delete check_fw

nvram commit

rc schedule start

GUI:

On Type Original Cronjob Event to Disable here web form type show_mem_log then click Add Disabled Cronjob

On Type Original Cronjob Event to Disable here web form type check_fw then click Add Disabled Cronjob

To reactivate show_mem_log service only: select it from the list then click Remove Disabled .

To reactivate check_fw service only: select it from the list then click Remove Disabled .

Multiple choice selection from list is available.

Remove all of them at once clicking: Clear List