]> arthur.barton.de Git - trigger-rcmd.git/commitdiff
Redirect stderr when calling shutdown, too
authorAlexander Barton <alex@barton.de>
Sat, 27 Jan 2018 15:20:05 +0000 (16:20 +0100)
committerAlexander Barton <alex@barton.de>
Sat, 27 Jan 2018 15:20:07 +0000 (16:20 +0100)
This is required to not trigger "error detection" of some mail wrapper
scripts etc., that would notice output og shutdown(8) on stderr -- which
outputs messages there, even when there is NO error ...

scripts/trigger-rcmd

index 5d96d7fae9aab9bb9585bc7ac576dcd6adfbd76a..55df7388492355dbcd38e194194298281d2de408 100755 (executable)
@@ -102,7 +102,7 @@ do_rcmd() {
                if [ "$rsys_users" = "0" ]; then
                        echo "$NAME: Power off \"$SYSTEM\" again ..."
                        # shellcheck disable=2029
                if [ "$rsys_users" = "0" ]; then
                        echo "$NAME: Power off \"$SYSTEM\" again ..."
                        # shellcheck disable=2029
-                       ssh -o PreferredAuthentications=publickey -q "$SYSTEM" "sync; shutdown -hP $SHUTDOWN_TIME" >/dev/null
+                       ssh -o PreferredAuthentications=publickey -q "$SYSTEM" "sync; shutdown -hP $SHUTDOWN_TIME" 2>&1 >/dev/null
                        if [ $? -ne 0 ]; then
                                echo "$NAME: Failed to power off \"$SYSTEM\"!" >&2
                                return 5
                        if [ $? -ne 0 ]; then
                                echo "$NAME: Failed to power off \"$SYSTEM\"!" >&2
                                return 5