X-Git-Url: https://git.madduck.net/code/molly-guard.git/blobdiff_plain/a5b4c35be79dd109b9ac97b1e99275d6acae29f5..3ff2e8c0cde55785ef76980318b87d738082d4b8:/shutdown diff --git a/shutdown b/shutdown index 46aa45f..29bd8fe 100755 --- a/shutdown +++ b/shutdown @@ -90,12 +90,13 @@ test -t 0 || do_real_cmd # only run if we are being called over SSH, that is if the current terminal # was created by sshd. PTS=$(readlink /proc/$$/fd/0) -if ! pgrep -f "^sshd.+${PTS#/dev/}[[:space:]]*$" >/dev/null; then - if [ $PRETEND_SSH -eq 1 ]; then - echo "I: this is not an SSH session, but --pretend-ssh was given..." - else - do_real_cmd - fi +if ! pgrep -f "^sshd.+${PTS#/dev/}[[:space:]]*$" >/dev/null \ + && [ -z "$SSH_CONNECTION" ]; then + if [ $PRETEND_SSH -eq 1 ]; then + echo "I: this is not an SSH session, but --pretend-ssh was given..." + else + do_real_cmd + fi else echo "W: $ME: SSH session detected!" fi @@ -108,7 +109,7 @@ case "$CMD $ARGS" in ;; esac -HOSTNAME="$(hostname)" +HOSTNAME="$(hostname --short)" sigh() {