python*: Use poll instead of select in ckflush.
[ashd.git] / etc / debian / init.d-ashd
1 #!/bin/sh
2 ### BEGIN INIT INFO
3 # Provides:          ashd
4 # Required-Start:    $local_fs $remote_fs $network $syslog
5 # Required-Stop:     $local_fs $remote_fs $network $syslog
6 # Default-Start:     2 3 4 5
7 # Default-Stop:      0 1 6
8 # Short-Description: The ashd HTTP server
9 ### END INIT INFO
10
11 set -e
12
13 . /lib/lsb/init-functions
14
15 PATH=/usr/local/bin:/usr/local/sbin:$PATH
16 HTPARSER="$(which htparser || true)"
17 PIDFILE=/var/run/ashd.pid
18 PORTSPEC="plain"
19 ROOTSPEC="dirplex /srv/www"
20 [ -r /etc/default/locale ] && . /etc/default/locale
21 [ -r /etc/default/ashd ] && . /etc/default/ashd
22 [ -x "$HTPARSER" ] || exit 0
23
24 start() {
25     export LANG
26     log_daemon_msg "Starting HTTP server" "ashd"
27     start-stop-daemon -S -p "$PIDFILE" -qx "$HTPARSER" -- -Sf -p "$PIDFILE" -u nobody -r /var/tmp $PORTSPEC -- $ROOTSPEC
28     log_end_msg $?
29 }
30
31 stop() {
32     log_daemon_msg "Stopping HTTP server" "ashd"
33     start-stop-daemon -K -p "$PIDFILE" -qx "$HTPARSER"
34     log_end_msg $?
35 }
36
37 case "$1" in
38     start)
39         start
40         ;;
41     stop)
42         stop
43         ;;
44     restart)
45         stop
46         start
47         ;;
48 esac
49
50 exit 0