From e1f134ead584c7b2e9ed406f5520d7f1a23294aa Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 5 Jul 2018 15:29:26 +0200 Subject: add scripts --- manage-umts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 manage-umts (limited to 'manage-umts') 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 +# +# 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; + }; +}; -- cgit v1.2.3-70-g09d2