Minor fixes and documentation updates

This commit is contained in:
Pothi Kalimuthu 2022-02-21 06:57:29 +05:30
parent 37c9394986
commit 5cfac94956
3 changed files with 21 additions and 15 deletions

View file

@ -40,6 +40,14 @@
# Configure Identity # Configure Identity
/system identity set name=$myIdentity; /system identity set name=$myIdentity;
# Minor Tweaks
/system routerboard settings set init-delay=3
/interface detect-internet
set detect-interface-list=WAN
set lan-interface-list=LAN
set wan-interface-list=all
set internet-interface-list=all
# Change subnet # Change subnet
/ip pool add name=$dhcpName ranges=$dhcpPoolRange; /ip pool add name=$dhcpName ranges=$dhcpPoolRange;
/ip pool remove default-dhcp; /ip pool remove default-dhcp;

View file

@ -1,14 +1,14 @@
# Alert upon new version # Alert upon new Router OS Version
# requirement/s: # requirement/s:
# policy: read, write, policy, test # policy: read, write, policy, test
:local adminEmailAddress "admin@example.com" :local adminEmail "admin@example.com"
:local startDelay "100s" :local startDelay "90s"
# if you run this script at "startup", # if you run this script at "startup",
# the following indicates the time for the internet to go "up" # the following indicates the time for the internet to go "up"
# ToDo: Find it out dynamically # ToDo: Find it out dynamically
:delay $startDelay # :delay $startDelay
:log info "Checking for new version of RouterOS..." :log info "Checking for new version of RouterOS..."
@ -27,18 +27,14 @@ check-for-updates once
# :set $versionStatus ([print as-value]->"status") # :set $versionStatus ([print as-value]->"status")
} while=( $versionStatus = "finding out latest version..." ) } while=( $versionStatus = "finding out latest version..." )
# for debugging
# :put $versionStatus
# :put $adminEmailAddress
:local installedVersion [get installed-version] :local installedVersion [get installed-version]
:local latestVersion [get latest-version] :local latestVersion [get latest-version]
:if ( $versionStatus = "New version is available" ) do={ :if ( $versionStatus = "New version is available" ) do={
# alternative method # alternative method
# :if ( installedVersion != $latestVersion ) do={ # :if ( installedVersion != $latestVersion ) do={
:log info "A new update is available for Router OS and an email is probably sent to $adminEmailAddress." :log info "A new update is available for Router OS and an email is probably sent to $adminEmail."
/tool e-mail send to="$adminEmailAddress" \ /tool e-mail send to="$adminEmail" \
subject="[Mikrotik $deviceIdentity] Software Update is Available" \ subject="[Mikrotik $deviceIdentity] Software Update is Available" \
body="A new update is available for your MikroTik device: \"$deviceIdentity\" ... body="A new update is available for your MikroTik device: \"$deviceIdentity\" ...

View file

@ -7,8 +7,8 @@
# Note: The SMS is removed from the inbox after sent by Email and forwarded # Note: The SMS is removed from the inbox after sent by Email and forwarded
# even if email and forward fail! So, test it often! # even if email and forward fail! So, test it often!
:local adminEmailAddress "pothi@duck.com" :local adminEmail "admin@example.com"
:local smsForwardPh 9952697255 :local smsForwardPh 9876543210
:local smsPhone :local smsPhone
:local smsMessage :local smsMessage
@ -24,11 +24,13 @@
:log info "SMS Received From: $smsPhone at $smsTimeStamp Message: $smsMessage" :log info "SMS Received From: $smsPhone at $smsTimeStamp Message: $smsMessage"
# Forward the SMS to $smsForwardPh # Forward the SMS to $smsForwardPh
/tool sms send lte1 phone-number=$smsForwardPh message="From: $smsPhone on $smsTimeStamp Msg: $smsMessage"; :do {
/tool sms send lte1 phone-number=$smsForwardPh message="From: $smsPhone Date:$smsTimeStamp Msg: $smsMessage"
} on-error={ /tool e-mail send to="$adminEmail" subject="Sending SMS Failed" body="Check the log" }
:delay 2s :delay 2s
# Send Email to $adminEmailAddress # Send Email to $adminEmail
/tool e-mail send to="$adminEmailAddress" body="$smsMessage" \ /tool e-mail send to="$adminEmail" body="$smsMessage" \
subject="SMS from $smsPhone at $smsTimeStamp" subject="SMS from $smsPhone at $smsTimeStamp"
:delay 3s :delay 3s