source: trunk/packages/sipb-xen-www/files/etc/init.d/apache2.invirt @ 1070

Last change on this file since 1070 was 1045, checked in by broder, 16 years ago

Attempt to get Apache and OpenAFS to start in the right order

  • 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/apache2/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        -U -f "$KSTART_KEYTAB" -K10 -S afs -I "$AFSCELL" -t -b
28    cat "$TMP_PIDFILE" >|"$KSTART_PIDFILE"
29    rm -f "$TMP_PIDFILE"
30}
31kstart_stop () {
32    if [ -e $KSTART_PIDFILE ]; then
33        /sbin/start-stop-daemon --stop --pidfile $KSTART_PIDFILE
34        rm -f $KSTART_PIDFILE
35    else
36        echo -n " ... no kstart pidfile"
37    fi
38}
39
40case "$1" in
41  start)
42    echo -n "Starting kstart for Apache2: k5start"
43    kstart_start
44    echo "."
45    exec "$SCRIPT" start
46    ;;
47  stop)
48    "$SCRIPT" stop
49    echo -n "Stopping kstart for Apache2: k5start"
50    kstart_stop
51    echo "."
52    ;;
53  restart|force-reload)
54    "$0" stop
55    sleep 1
56    "$0" start
57    ;;
58  *)
59    exec "$SCRIPT" "$@"
60    ;;
61esac
Note: See TracBrowser for help on using the repository browser.