sms-action: move configuration to global-config

This commit is contained in:
Christian Hesse 2018-09-13 22:05:36 +02:00
parent 374c9c09ba
commit 95794d0367
2 changed files with 14 additions and 22 deletions

View file

@ -47,6 +47,13 @@
# add mode here...
};
# Run commands on SMS action.
:global "sms-action" {
shutdown="/ system shutdown";
reboot="/ system reboot";
# add more here...
}
# This address should resolve ntp servers and is used to update
# ntp settings. A pool can rotate servers.
:global "ntp-pool" "pool.ntp.org";

View file

@ -4,26 +4,11 @@
#
# run action on received SMS
:log info ("Received SMS with action '" . $action . "'");
# delay a second to give log servers a chance to get the info
:global "sms-action";
:local code ($"sms-action"->$action);
:local parsed [ :parse $code ];
:log info ("Acting on SMS action '" . $action . "': " . $code);
:delay 1s;
:if ($action = "reboot") do={
/ system reboot;
}
:if ($action = "shutdown") do={
/ system shutdown;
}
:if ($action = "update") do={
/ system package update install;
}
:if ($action= "trackon") do={
/ system scheduler enable gps-track;
}
:if ($action = "trackoff") do={
/ system scheduler disable gps-track;
}
$parsed;