1 #!/usr/bin/pagsh.openafs
5 # NAME=name run-in-pagsh command arguments ...
9 # NAME=interchange run-in-pagsh ~/interchange/bin/interchange
11 # Make sure that the ~/.run directory exists and is writable.
12 # See http://wiki2.hcoop.net/MemberManual/RunningUnattendedCommands
13 # for instructions on how to accomplish this.
16 if test -z "$NAME"; then
17 echo "Error: you must set the NAME environment variable before" \
18 "running this script."
20 elif test -z "$1"; then
21 echo "Error: you must provide the command to run and its arguments."
23 elif test ! -d "~/.run"; then
24 echo "Error: the ~/.run directory must exist before running this script."
28 # Use a different PID file for each program.
29 K5PID=~/.run/${NAME}.pid
35 KTAB=/etc/keytabs/user.daemon/$USER
37 # Terminate current k5start process, if one is running.
38 if test -f "$K5PID"; then
39 kill `cat -- "$K5PID"`
43 # Start fresh k5start daemon which will be refreshing tickets every 540 min
44 /usr/bin/k5start -U -b -K 540 -t -p "$K5PID" -f "$KTAB"
46 # Run actual service with arguments as provided on command line