X-Git-Url: http://git.hcoop.net/clinton/scripts.git/blobdiff_plain/9bc6a43d1017d87d6b7f6338cf313dbeb4b4bdb4..4ead870dfc40bf8955b1e324141b11de46aad40c:/run-in-pagsh?ds=sidebyside diff --git a/run-in-pagsh b/run-in-pagsh index a8bcef8..5ef0e24 100755 --- a/run-in-pagsh +++ b/run-in-pagsh @@ -51,6 +51,18 @@ K5PID=$HOME/.run/$1.pid shift CMD="$*" +# Try to deduce the user we're running as. +if test -z "$USER"; then + if test -n "$LOGNAME"; then + USER=$LOGNAME + elif test -n "$HOME"; then + USER=$(basename "$HOME") + else + echo "Error: cannot deduce your username" + exit 1 + fi +fi + # Your keytab file. KTAB=/etc/keytabs/user.daemon/$USER