aboutsummaryrefslogtreecommitdiffstats
path: root/manage-umts
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2018-07-05 15:29:26 +0200
committerGravatar Christian Hesse <mail@eworm.de>2018-07-05 15:34:08 +0200
commite1f134ead584c7b2e9ed406f5520d7f1a23294aa (patch)
tree929660280fb0acc183401d7e59a40f1cd7e8992c /manage-umts
parent1d99dc38ff1f583d6e46adc5d1ba3455114d53c1 (diff)
add scripts
Diffstat (limited to 'manage-umts')
-rw-r--r--manage-umts26
1 files changed, 26 insertions, 0 deletions
diff --git a/manage-umts b/manage-umts
new file mode 100644
index 0000000..d9e5a0b
--- /dev/null
+++ b/manage-umts
@@ -0,0 +1,26 @@
+# RouterOS script: manage-umts
+# Copyright (c) 2013-2018 Christian Hesse <mail@eworm.de>
+#
+# manage UMTS interface based on ethernet and wireless status
+
+:local etherint "en1";
+:local wlanint "wl-station";
+:local umtsint "t-mobile";
+
+:local etherstatus [ / interface ethernet get $etherint running ];
+:local wlanstatus [ / interface wireless get $wlanint running ];
+
+:if ( $etherstatus = true || wlanstatus = true ) do={
+ :if ( [ / interface get $umtsint disabled ] = false ) do={
+ :log info ("Ethernet (" . $etherint . " / " . $etherstatus . ") or " . \
+ "wireless (" . $wlanint . " / " . $wlanstatus . ") is running, " . \
+ "UMTS interface " . $umtsint . " is enabled. Disabling...");
+ / interface set disabled=yes $umtsint;
+ };
+} else={
+ :if ( [ / interface get $umtsint disabled ] = true ) do={
+ :log info ("Neither ethernet (" . $etherint . ") nor wireless (" . $wlanint . ") interface is running, " . \
+ "UMTS interface " . $umtsint . " is disabled. Enabling...");
+ / interface set disabled=no $umtsint;
+ };
+};