mirror of
https://github.com/pothi/mikrotik-scripts.git
synced 2025-07-02 02:34:29 +02:00
Minor fixes and documentation updates
This commit is contained in:
parent
37c9394986
commit
5cfac94956
3 changed files with 21 additions and 15 deletions
|
@ -1,14 +1,14 @@
|
|||
# Alert upon new version
|
||||
# Alert upon new Router OS Version
|
||||
|
||||
# requirement/s:
|
||||
# policy: read, write, policy, test
|
||||
:local adminEmailAddress "admin@example.com"
|
||||
:local startDelay "100s"
|
||||
:local adminEmail "admin@example.com"
|
||||
:local startDelay "90s"
|
||||
|
||||
# if you run this script at "startup",
|
||||
# the following indicates the time for the internet to go "up"
|
||||
# ToDo: Find it out dynamically
|
||||
:delay $startDelay
|
||||
# :delay $startDelay
|
||||
|
||||
:log info "Checking for new version of RouterOS..."
|
||||
|
||||
|
@ -27,18 +27,14 @@ check-for-updates once
|
|||
# :set $versionStatus ([print as-value]->"status")
|
||||
} while=( $versionStatus = "finding out latest version..." )
|
||||
|
||||
# for debugging
|
||||
# :put $versionStatus
|
||||
# :put $adminEmailAddress
|
||||
|
||||
:local installedVersion [get installed-version]
|
||||
:local latestVersion [get latest-version]
|
||||
|
||||
:if ( $versionStatus = "New version is available" ) do={
|
||||
# alternative method
|
||||
# :if ( installedVersion != $latestVersion ) do={
|
||||
:log info "A new update is available for Router OS and an email is probably sent to $adminEmailAddress."
|
||||
/tool e-mail send 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="$adminEmail" \
|
||||
subject="[Mikrotik $deviceIdentity] Software Update is Available" \
|
||||
body="A new update is available for your MikroTik device: \"$deviceIdentity\" ...
|
||||
|
||||
|
|
38
scripts/sms-forward-email.rsc
Normal file
38
scripts/sms-forward-email.rsc
Normal file
|
@ -0,0 +1,38 @@
|
|||
# SMS Forward and Email
|
||||
|
||||
# ToDo: Shorten the timestamp.
|
||||
|
||||
# Source: https://forum.mikrotik.com/viewtopic.php?f=9&t=61068#p312202
|
||||
|
||||
# Note: The SMS is removed from the inbox after sent by Email and forwarded
|
||||
# even if email and forward fail! So, test it often!
|
||||
|
||||
:local adminEmail "admin@example.com"
|
||||
:local smsForwardPh 9876543210
|
||||
|
||||
:local smsPhone
|
||||
:local smsMessage
|
||||
:local smsTimeStamp
|
||||
|
||||
/tool sms inbox
|
||||
|
||||
:foreach i in=[find] do={
|
||||
:set smsPhone [get $i phone]
|
||||
:set smsMessage [get $i message]
|
||||
:set smsTimeStamp [get $i timestamp]
|
||||
|
||||
:log info "SMS Received From: $smsPhone at $smsTimeStamp Message: $smsMessage"
|
||||
|
||||
# Forward the SMS to $smsForwardPh
|
||||
: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
|
||||
|
||||
# Send Email to $adminEmail
|
||||
/tool e-mail send to="$adminEmail" body="$smsMessage" \
|
||||
subject="SMS from $smsPhone at $smsTimeStamp"
|
||||
:delay 3s
|
||||
|
||||
remove $i
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue