From a6d4e5eec8c7a7a78e883941d13caf3fb9623ea9 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 6 Aug 2018 16:05:34 +0200 Subject: add script 'sms-action' --- sms-action | 26 ++++++++++++++++++++++++++ sms-forward | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 sms-action diff --git a/sms-action b/sms-action new file mode 100644 index 0000000..3d3fd5a --- /dev/null +++ b/sms-action @@ -0,0 +1,26 @@ +# RouterOS script: sms-action +# Copyright (c) 2018 Christian Hesse +# +# run action on received SMS + +:log info ("Received SMS with action '" . $action . "'"); + +: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; +} diff --git a/sms-forward b/sms-forward index 64b8355..cbf445c 100644 --- a/sms-forward +++ b/sms-forward @@ -13,7 +13,7 @@ } # forward SMS in a loop -:foreach sms in=[ / tool sms inbox find ] do={ +:foreach sms in=[ / tool sms inbox find where message~"^([^:][^c][^m][^d][^ ])" ] do={ :local message [ / tool sms inbox get $sms message ]; :local phone [ / tool sms inbox get $sms phone ]; :local timestamp [ / tool sms inbox get $sms timestamp ]; -- cgit v1.2.3-54-g00ecf