aboutsummaryrefslogtreecommitdiffstats
path: root/sms-action
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2018-09-13 22:05:36 +0200
committerGravatar Christian Hesse <mail@eworm.de>2018-09-13 22:07:12 +0200
commit95794d03672088162cebdab866a73391fca05a63 (patch)
treed712d8e7d12797ede5a747a3fcc8ebc9d17d6c30 /sms-action
parent374c9c09ba93e5cefde9cf21799e5ae65720bcd7 (diff)
sms-action: move configuration to global-config
Diffstat (limited to 'sms-action')
-rw-r--r--sms-action27
1 files changed, 6 insertions, 21 deletions
diff --git a/sms-action b/sms-action
index 7ff4b8f..2b1e4d6 100644
--- a/sms-action
+++ b/sms-action
@@ -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
-:delay 1s;
-
-:if ($action = "reboot") do={
- / system reboot;
-}
-
-:if ($action = "shutdown") do={
- / system shutdown;
-}
+:global "sms-action";
-:if ($action = "update") do={
- / system package update install;
-}
+:local code ($"sms-action"->$action);
+:local parsed [ :parse $code ];
-:if ($action= "trackon") do={
- / system scheduler enable gps-track;
-}
-
-:if ($action = "trackoff") do={
- / system scheduler disable gps-track;
-}
+:log info ("Acting on SMS action '" . $action . "': " . $code);
+:delay 1s;
+$parsed;