From 62249261a20ddb62ca9ca9178f6d9b2b670891ec Mon Sep 17 00:00:00 2001 From: menzel Date: Fri, 12 Dec 2025 19:25:52 +0100 Subject: [PATCH] fixing a typo in EPICS2SMS.sh --- EPICS2SMS.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/EPICS2SMS.sh b/EPICS2SMS.sh index 830dfa3..60241f5 100755 --- a/EPICS2SMS.sh +++ b/EPICS2SMS.sh @@ -3,14 +3,14 @@ # --- configuration --------------------------------------------------------- # PV_NAME="X12SA-FE-VMMG-0010:PLC_RELAY-D" # a PV with states "ON"/"OFF" -PV_NAME="AGEBD-PARAMS:INJECTION-RATE" # a PV with numerical value + units -PHONE_NUMBER="0041793083005" # the phone number(s), space separated -EMAIL="andreas.menzel@psi.ch" # the email address(es), space separated -POLL_INTERVAL=5 # seconds between polls while Running -ERROR_INTERVAL=60 # seconds between polls while NOT Running +PV_NAME="AGEBD-PARAMS:INJECTION-RATE" # a PV with numerical value + units +PHONE_NUMBER="0041793083005" # the phone number(s), space separated +EMAIL="andreas.menzel@psi.ch" # the email address(es), space separated +POLL_INTERVAL=5 # seconds between polls while Running +ERROR_INTERVAL=60 # seconds between polls while NOT Running send_sms() { - local numbers="$1 $2" # to combine PHONE_NUMBER and EMAIL + local numbers="$1 $2" # to combine PHONE_NUMBER and EMAIL local message="$3" local email_hdr="" @@ -32,19 +32,19 @@ send_sms() { printf "%s" "$email_hdr" printf "\n" printf "%s\n" "$message_with_date" -# } | cat # for testing - } | /usr/sbin/sendmail -t # for production + # } | cat # for testing + } | /usr/sbin/sendmail -t # for production } # --- main loop ------------------------------------------------------------ -alert_sent=0 # 0 = no alert sent for current outage, 1 = already sent +alert_sent=0 # 0 = no alert sent for current outage, 1 = already sent echo "[$(date)] Starting EPICS monitor for PV '$PV_NAME' ..." while true; do # Get PV value as a plain string; adjust flags if needed (-S for string) -# caget "$PV_NAME" # only for debugging + # caget "$PV_NAME" # only for debugging value=$(caget -noname -nounit "$PV_NAME" 2>/dev/null) status=$? @@ -54,8 +54,8 @@ while true; do value="UNAVAILABLE" fi -# if [[ "$value" == "\"ON\"" ]]; then # for a PV with states "ON"/"OFF" - if awk "BEGIN { exit !($value > 0) }"; then # to check whether value is smaller than zero + # if [[ "$value" == "\"ON\"" ]]; then # for a PV with states "ON"/"OFF" + if awk "BEGIN { exit !($value < 0) }"; then # to check whether value is smaller than zero # System is OK again if [[ $alert_sent -eq 1 ]]; then echo "[$(date)] PV '$PV_NAME' back to Running."