Simplified the default init script.
[ashd.git] / etc / debian / init.d-ashd
CommitLineData
9f61b28a
FT
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
11set -e
12
13. /lib/lsb/init-functions
14
15PATH=/usr/local/bin:/usr/local/sbin:$PATH
16HTPARSER="$(which htparser || true)"
17PIDFILE=/var/run/ashd.pid
18PORTSPEC="plain"
c6b5fb27 19ROOTSPEC="dirplex /srv/www"
9f61b28a
FT
20[ -r /etc/default/locale ] && . /etc/default/locale
21[ -r /etc/default/ashd ] && . /etc/default/ashd
22[ -x "$HTPARSER" ] || exit 0
23
24start() {
25 export LANG
26 log_daemon_msg "Starting HTTP server" "ashd"
27 ulimit -c unlimited
28 start-stop-daemon -S -p "$PIDFILE" -qx "$HTPARSER" -- -Sf -p "$PIDFILE" -u nobody -r /var/tmp $PORTSPEC -- $ROOTSPEC
29 log_end_msg $?
30}
31
32stop() {
33 log_daemon_msg "Stopping HTTP server" "ashd"
34 start-stop-daemon -K -p "$PIDFILE" -qx "$HTPARSER"
35 log_end_msg $?
36}
37
38case "$1" in
39 start)
40 start
41 ;;
42 stop)
43 stop
44 ;;
45 restart)
46 stop
47 start
48 ;;
49esac
50
51exit 0