Showing 1 changed files with 6 additions and 1 deletions
+6 -1
rtcwake
... ...
@@ -28,7 +28,12 @@ case "$1/$2" in
28 28
         if test $NOW -ge ${AWAKE_TIME//:} -a $NOW -le $(date +%_H%M%S -d "$AWAKE_TIME $GAP"); then
29 29
             COUNT=1
30 30
             while sleep $WAIT_TRIGGER_DELAY && eval $WAIT_TRIGGER; do
31
-                let COUNT++ && [ $COUNT -lt $MAX_TRIGGER ] || exit 0
31
+                let COUNT++ && [ $COUNT -lt $MAX_TRIGGER ] || {
32
+                    if test -n "$MAIL_ERROR"; then
33
+                        echo -e "WAIT_TRIGGER_DELAY=$WAIT_TRIGGER_DELAY\nMAX_TRIGGER=$MAX_TRIGGER\nWAIT_TRIGGER=$WAIT_TRIGGER\n\n" | mail -s "${0##*/}" $MAIL_ERROR
34
+                    fi
35
+                    exit 0
36
+                }
32 37
             done
33 38
             rtcwake -m mem -t $RTCWAKE_TIME
34 39
         else