1 #!/usr/bin/pagsh.openafs
6 # run-in-pagsh name command [arguments] ...
8 # The first argument, `name', is a short description of the program to
9 # call, without any spaces. It is used for making a PID file, which
10 # ensures that only one instance of your command is running.
14 # run-in-pagsh interchange ~/interchange/bin/interchange
16 # Make sure that the ~/.run directory exists and is writable.
17 # See http://wiki2.hcoop.net/MemberManual/RunningUnattendedCommands
18 # for instructions on how to accomplish this.
22 echo "Error: not enough arguments."
23 echo "Usage: run-in-pagsh name command [arguments] ..."
25 elif test ! -d "$HOME/.run"; then
26 echo "Error: the ~/.run directory must exist before running this script."
30 # Use a different PID file for each program.
31 K5PID=$HOME/.run/$1.pid
38 KTAB=/etc/keytabs/user.daemon/$USER
40 # Terminate current k5start process, if one is running.
41 if test -f "$K5PID"; then
42 kill `cat -- "$K5PID"`
43 /usr/bin/k5start -qtU -f "$KTAB" -- rm -f "$K5PID"
46 # Start fresh k5start daemon which will be refreshing tickets every 540 min
47 /usr/bin/k5start -U -b -K 540 -t -p "$K5PID" -f "$KTAB"
49 # Run actual service with arguments as provided on command line