]> git.madduck.net Git - code/molly-guard.git/blobdiff - shutdown

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Also require $SSH_CONNECTION to be unset or warn
[code/molly-guard.git] / shutdown
index 46aa45f7e0a2cf3d3795a6f43d05c22e1166bee6..29bd8fe607102b41839c1ba30f78fc3d7e1c6d7e 100755 (executable)
--- 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)
 # 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
 else
   echo "W: $ME: SSH session detected!"
 fi
@@ -108,7 +109,7 @@ case "$CMD $ARGS" in
     ;;
 esac
 
     ;;
 esac
 
-HOSTNAME="$(hostname)"
+HOSTNAME="$(hostname --short)"
 
 sigh()
 {
 
 sigh()
 {