From 1744ffa992fe590af70b9fc47d987c7171cc0864 Mon Sep 17 00:00:00 2001 From: Grzegorz Budny Date: Sun, 24 Nov 2019 17:29:37 +0100 Subject: [PATCH] Initial Commit --- RouterOS_Format_Drive.rsc | 18 ++++++++++++++++++ RouterOS_R_ARP.rsc | 20 ++++++++++++++++++++ RouterOS_Substring_Variable.rsc | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 RouterOS_Format_Drive.rsc create mode 100644 RouterOS_R_ARP.rsc create mode 100644 RouterOS_Substring_Variable.rsc diff --git a/RouterOS_Format_Drive.rsc b/RouterOS_Format_Drive.rsc new file mode 100644 index 0000000..a351c7b --- /dev/null +++ b/RouterOS_Format_Drive.rsc @@ -0,0 +1,18 @@ +# RouterOS Function +# Copyright (c) Grzegorz Budny +# Formats RouterOS additional drive + +:global FormatDrive do={ + + :local driveLabel [/disk get number=$drive label]; + + :log warning ("...:::Drive ".$drive." ".$driveLabel." will be formatted!"); + + /disk eject-drive $drive; + /disk format-drive $drive file-system=$fileSystem label=$label; + + :log info ("...:::Drive ".$drive." has been formatted to ".$fileSystem." with label ".$label); + +} + +$FormatDrive drive=0 fileSystem=ext3 label=data; diff --git a/RouterOS_R_ARP.rsc b/RouterOS_R_ARP.rsc new file mode 100644 index 0000000..ea6727e --- /dev/null +++ b/RouterOS_R_ARP.rsc @@ -0,0 +1,20 @@ +# RouterOS Function +# Copyright (c) Grzegorz Budny +# ARP/RARP Function (shortange syntax) + +:global R_ARP do={ + + :if ($mode="ARP") do={ + + :return [/ip arp print where mac-address=$ip]; + + } + + :if ($mode="RARP") do={ + + :return [/ip arp print where mac-address=$mac]; + + } +} + +$R_ARP mode=mode; diff --git a/RouterOS_Substring_Variable.rsc b/RouterOS_Substring_Variable.rsc new file mode 100644 index 0000000..cd9dfbc --- /dev/null +++ b/RouterOS_Substring_Variable.rsc @@ -0,0 +1,23 @@ +# RouterOS Function +# Copyright (c) Grzegorz Budny +# Substring variable + +:global Subtring do={ + + :global substring; + + :if ($findMode=true) do={ + + :set $substring [:pick $string [:find $string $signA] [:find $string $signB]]; + :return $substring; + + }\ + else={ + + :set $substring [:pick $string $signA $signB]; + :return $substring; + + } +} + +$Substring findMode=true string="string" signA="A" signB "b";