WiFi enable and disable scripts / cron / scheduler events

This commit is contained in:
Pothi Kalimuthu 2022-11-09 07:58:33 +05:30
parent 80469763d7
commit f520a13473
No known key found for this signature in database
GPG key ID: 08202A469C2D0E06
2 changed files with 38 additions and 0 deletions

11
scripts/wifi-disable.rsc Normal file
View file

@ -0,0 +1,11 @@
# Disable WiFi interfaces at night via scheduler (cron).
# To avoid being locked out, make sure to run a script to enable wifi interfaces when you wake up.
# Also, put the wifi-enabler script in a button of your choice. Mode button or reset button. Mode button is recommended.
# See below...
/system scheduler
add comment="Shutdown WiFi @night to avoid electronic interference!" interval=1d name="WiFi Disable" on-event=\
"/int wifiwave2 disable [find]; /int wireless disable [find];" policy=ftp,reboot,read,write,policy,test start-date=mar/05/2022 start-time=00:04:00
# /system routerboard mode-button set enabled=yes on-event=":log info \"Mode button pressed\"; /int wifiwave2 enable [find]; /int wireless enable [find];"

27
scripts/wifi-enable.rsc Normal file
View file

@ -0,0 +1,27 @@
# Enable WiFi in the morning
# as a cron event
/system scheduler
add comment="Enable WiFi @morning" interval=1d name="WiFi Enable" on-event="/int wifiwave2 enable [find]; /int wireless enable [find];" \
policy=read,write,policy,test start-date=jan/03/2022 start-time=05:30:00
# as a script to be used
/interface wifiwave2
enable [find]
/interface wireless
# Enable all WiFi interfaces
# :if ( [get wifi2g disabled] = true ) do={ enable [find] }
# Enable selective WLANs
:if ( [get wifi2g disabled] = true ) do={ enable wifi2g } else={ :log info "wifi2g is already running" }
:if ( [get wifi5g disabled] = true ) do={ enable wifi5g } else={ :log info "wifi5g is already running" }
# :if ( [get [find master-interface=wifi2g] disabled] = true ) do={ enable [find master-interface=wifi2g] } else={ :log info "guest2g is already running." }
# :if ( [get [find master-interface=wifi5g] disabled] = true ) do={ enable [find master-interface=wifi5g] } else={ :log info "guests2g is already running." }