source: trunk/packages/invirt-web/files/etc/init.d/apache2.invirt @ 1807

Last change on this file since 1807 was 1690, checked in by broder, 16 years ago

Whoops - forgot to drop an option to k5start

  • Property svn:executable set to *
File size: 1.5 KB
Line 
1#!/usr/bin/pagsh -e
2### BEGIN INIT INFO
3# Provides:          apache2
4# Required-Start:    $local_fs $remote_fs $network $syslog openafs-client
5# Required-Stop:     $local_fs $remote_fs $network $syslog openafs-client
6# Default-Start:     2 3 4 5
7# Default-Stop:      0 1 6
8# Short-Description: Start/stop apache2 web server
9### END INIT INFO
10#
11# Apache kstart wrapper by anders.
12#
13
14SCRIPT=/etc/init.d/apache2.invirt-orig
15KSTART_PIDFILE=/var/run/k5start-apache2.pid
16KSTART_KEYTAB=/etc/invirt/keytab
17
18export AFSCELL=sipb.mit.edu
19
20kstart_start () {
21    TMP_PIDFILE=$(mktemp /tmp/k5start-apache2.pid-XXXXXX)
22    chown www-data "$TMP_PIDFILE"
23    export KRB5CCNAME=$(mktemp /tmp/krb5cc_33.kstart-XXXXXX)
24    chown www-data $KRB5CCNAME
25    /sbin/start-stop-daemon --start --pidfile "$TMP_PIDFILE" -c www-data \
26        --exec /usr/bin/k5start -- -b -p "$TMP_PIDFILE" \
27        -f "$KSTART_KEYTAB" -K10 -S afs -I "$AFSCELL" -t \
28        "daemon/$(hostname -f)"
29    cat "$TMP_PIDFILE" >|"$KSTART_PIDFILE"
30    rm -f "$TMP_PIDFILE"
31}
32kstart_stop () {
33    if [ -e $KSTART_PIDFILE ]; then
34        /sbin/start-stop-daemon --stop --pidfile $KSTART_PIDFILE
35        rm -f $KSTART_PIDFILE
36    else
37        echo -n " ... no kstart pidfile"
38    fi
39}
40
41case "$1" in
42  start)
43    echo -n "Starting kstart for Apache2: k5start"
44    kstart_start
45    echo "."
46    exec "$SCRIPT" start
47    ;;
48  stop)
49    "$SCRIPT" stop
50    echo -n "Stopping kstart for Apache2: k5start"
51    kstart_stop
52    echo "."
53    ;;
54  restart|force-reload)
55    "$0" stop
56    sleep 1
57    "$0" start
58    ;;
59  *)
60    exec "$SCRIPT" "$@"
61    ;;
62esac
Note: See TracBrowser for help on using the repository browser.