From: martin f. krafft Date: Sat, 19 Apr 2008 13:24:15 +0000 (+0200) Subject: write warnings and info messages to stderr X-Git-Tag: 0.4~2 X-Git-Url: https://git.madduck.net/code/molly-guard.git/commitdiff_plain/bd31543e20a53d41dd86c5f78f05b3fb3d5b8664?ds=sidebyside write warnings and info messages to stderr --- diff --git a/run.d/30-ask-hostname b/run.d/30-ask-hostname index 70b18d9..fc8f107 100755 --- a/run.d/30-ask-hostname +++ b/run.d/30-ask-hostname @@ -23,7 +23,7 @@ test -t 0 || exit 0 # we've been asked to always protect this host if [ ${ALWAYS_QUERY_HOSTNAME:-0} -eq 1 ]; then - echo "I: $ME: $MOLLYGUARD_CMD is always molly-guarded on this system." + echo "I: $ME: $MOLLYGUARD_CMD is always molly-guarded on this system." >&2 else # only run if we are being called over SSH, that is if the current terminal # was created by sshd. @@ -31,12 +31,12 @@ else if ! pgrep -f "^sshd.+${PTS#/dev/}[[:space:]]*$" >/dev/null \ && [ -z "${SSH_CONNECTION:-}" ]; then if [ $PRETEND_SSH -eq 1 ]; then - echo "I: $ME: this is not an SSH session, but --pretend-ssh was given..." + echo "I: $ME: this is not an SSH session, but --pretend-ssh was given..." >&2 else exit 0 fi else - echo "W: $ME: SSH session detected!" + echo "W: $ME: SSH session detected!" >&2 fi fi @@ -44,7 +44,7 @@ HOSTNAME="$(hostname --short)" sigh() { - echo "Good thing I asked; I won't $MOLLYGUARD_CMD $HOSTNAME ..." + echo "Good thing I asked; I won't $MOLLYGUARD_CMD $HOSTNAME ..." >&2 exit 1 } diff --git a/shutdown b/shutdown index be733b7..2e24f7f 100755 --- a/shutdown +++ b/shutdown @@ -90,14 +90,14 @@ do_real_cmd() } if [ $DO_NOTHING -eq 1 ]; then - echo "I: demo mode; $ME will not do anything due to --molly-guard-do-nothing." + echo "I: demo mode; $ME will not do anything due to --molly-guard-do-nothing." >&2 fi # pass through certain commands case "$CMD $CMDARGS" in (*shutdown\ *-c*) # allow canceling shutdowns - echo "I: executing $CMD $CMDARGS regardless of check results." + echo "I: executing $CMD $CMDARGS regardless of check results." >&2 do_real_cmd ;; esac @@ -110,7 +110,7 @@ for script in $(run-parts --test $SCRIPTSDIR); do ret=0 eval $script $SCRIPTARGS || ret=$? if [ $ret -ne 0 ]; then - echo "W: aborting $CMD due to ${script##*/} exiting with code $ret." + echo "W: aborting $CMD due to ${script##*/} exiting with code $ret." >&2 exit $ret fi done