mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Allow to exec a script when interface up or down
This commit is contained in:
parent
4aee443da6
commit
65a9d5e055
1 changed files with 5 additions and 0 deletions
|
@ -280,6 +280,8 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ]; then
|
|||
echo -e "Subject: $OMR_SYSNAME: $OMR_TRACKER_INTERFACE ($OMR_TRACKER_DEVICE) is down\n\nConnection failure of $OMR_TRACKER_INTERFACE ($OMR_TRACKER_DEVICE) detected. The reason is \"$OMR_TRACKER_STATUS_MSG\"." | sendmail $(uci -q get mail.default.to)
|
||||
fi
|
||||
}
|
||||
script_alert_down="$(uci -q get omr-tracker.$OMR_TRACKER_INTERFACE.script_alert_down)"
|
||||
[ -n "$script_alert_down" ] && eval $script_alert_down
|
||||
|
||||
if [ "$OMR_TRACKER_INTERFACE" = "glorytun" ] || [ "$OMR_TRACKER_INTERFACE" = "omrvpn" ]; then
|
||||
if [ "$OMR_TRACKER_STATUS_MSG" = "" ]; then
|
||||
|
@ -391,6 +393,9 @@ if [ "$OMR_TRACKER_PREV_STATUS" != "" ] && [ "$OMR_TRACKER_PREV_STATUS" != "$OMR
|
|||
OMR_SYSNAME="$(uci -q get system.@system[0].hostname)"
|
||||
echo -e "Subject: $OMR_SYSNAME: $OMR_TRACKER_INTERFACE ($OMR_TRACKER_DEVICE) is up\n\nDetected that connection $OMR_TRACKER_INTERFACE ($OMR_TRACKER_DEVICE) is up again." | sendmail $(uci -q get mail.default.to)
|
||||
}
|
||||
script_alert_up="$(uci -q get omr-tracker.$OMR_TRACKER_INTERFACE.script_alert_up)"
|
||||
[ -n "$script_alert_up" ] && eval $script_alert_up
|
||||
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.state='up'
|
||||
uci -q commit openmptcprouter
|
||||
dns_flush
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue