HCoop
/
clinton
/
scripts.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9bc6a43
)
run-in-pagsh: Figure out what user we're running as
author
mwolson_admin
<mwolson_admin@deleuze.hcoop.net>
Wed, 14 Nov 2007 03:38:56 +0000
(22:38 -0500)
committer
mwolson_admin
<mwolson_admin@deleuze.hcoop.net>
Wed, 14 Nov 2007 03:38:56 +0000
(22:38 -0500)
Cron can be stupid sometimes and set LOGNAME, but not USER.
run-in-pagsh
patch
|
blob
|
blame
|
history
diff --git
a/run-in-pagsh
b/run-in-pagsh
index
a8bcef8
..
5ef0e24
100755
(executable)
--- a/
run-in-pagsh
+++ b/
run-in-pagsh
@@
-51,6
+51,18
@@
K5PID=$HOME/.run/$1.pid
shift
CMD="$*"
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
# Your keytab file.
KTAB=/etc/keytabs/user.daemon/$USER