File: krenew-agent

package info (click to toggle)
kstart 4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,884 kB
  • sloc: ansic: 5,937; sh: 4,785; perl: 2,130; makefile: 142
file content (34 lines) | stat: -rwxr-xr-x 779 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# krenew-agent - 

DATE=`date '+%Y-%m-%d %H:%M:%S'`
FILE="/tmp/krb5cc_$1"
PIDFILE="${FILE}.pid"
LOGFILE="${FILE}.log"
KRENEW_ARGS="-K 10 -t -v -p ${PIDFILE}"

if [ "x$1" == "x" ] ; then
    echo "Usage: $0 USER"
    exit 0
fi

if [ ! -f ${FILE} ] ; then
    echo "No ticket cache to work with: ${FILE}"
    exit 0
fi

touch ${LOGFILE}

if [ ! -f ${PIDFILE} ] ; then
    echo "${DATE} Starting new krenew" | tee -a ${LOGFILE}
    touch ${LOGFILE}
    krenew ${KRENEW_ARGS} 2>&1 & >> ${LOGFILE}
else
    PID=`cat ${PIDFILE}`
    if kill -0 ${PID}  2>/dev/null; then
        echo "${DATE} Already running (pid ${PID})" | tee -a ${LOGFILE}
    else
        echo "${DATE} Restarting krenew" | tee -a ${LOGFILE}
        krenew ${KRENEW_ARGS} 2>&1 >> ${LOGFILE} &
    fi
fi