~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to utopic/etc/init.d/lighttpd

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
### BEGIN INIT INFO
3
 
# Provides:          lighttpd
4
 
# Required-Start:    $syslog $remote_fs $network
5
 
# Required-Stop:     $syslog $remote_fs $network
6
 
# Should-Start:      fam
7
 
# Should-Stop:       fam
8
 
# Default-Start:     2 3 4 5
9
 
# Default-Stop:      0 1 6
10
 
# Short-Description: Start the lighttpd web server.
11
 
# Description:       Fast and smalle webserver with minimal memory footprint
12
 
#                    developed with security in mind HTTP/1.1 compliant caching
13
 
#                    proxy server.
14
 
### END INIT INFO
15
 
 
16
 
 
17
 
PATH=/sbin:/bin:/usr/sbin:/usr/bin
18
 
DAEMON=/usr/sbin/lighttpd
19
 
NAME=lighttpd
20
 
DESC="web server"
21
 
PIDFILE=/var/run/$NAME.pid
22
 
SCRIPTNAME=/etc/init.d/$NAME
23
 
 
24
 
DAEMON_OPTS="-f /etc/lighttpd/lighttpd.conf"
25
 
 
26
 
test -x $DAEMON || exit 0
27
 
 
28
 
set -e
29
 
 
30
 
check_syntax()
31
 
{
32
 
        $DAEMON -t $DAEMON_OPTS > /dev/null || exit $?
33
 
}
34
 
 
35
 
if [ "$1" != status ]; then
36
 
        # be sure there is a /var/run/lighttpd, even with tmpfs
37
 
        # The directory is defined as volatile and may thus be non-existing
38
 
        # after a boot (DPM §9.3.2)
39
 
        if ! dpkg-statoverride --list /var/run/lighttpd >/dev/null 2>&1; then
40
 
                install -d -o www-data -g www-data -m 0750 "/var/run/lighttpd"
41
 
        fi
42
 
fi
43
 
 
44
 
. /lib/lsb/init-functions
45
 
 
46
 
case "$1" in
47
 
    start)
48
 
        check_syntax
49
 
        log_daemon_msg "Starting $DESC" $NAME
50
 
        if ! start-stop-daemon --start --oknodo --quiet \
51
 
            --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
52
 
        then
53
 
            log_end_msg 1
54
 
        else
55
 
            log_end_msg 0
56
 
        fi
57
 
        ;;
58
 
    stop)
59
 
        log_daemon_msg "Stopping $DESC" $NAME
60
 
        if start-stop-daemon --stop --retry 30 --oknodo --quiet \
61
 
            --pidfile $PIDFILE --exec $DAEMON
62
 
        then
63
 
            rm -f $PIDFILE
64
 
            log_end_msg 0
65
 
        else
66
 
            log_end_msg 1
67
 
        fi
68
 
        ;;
69
 
    reload|force-reload)
70
 
        check_syntax
71
 
        log_daemon_msg "Reloading $DESC configuration" $NAME
72
 
        if start-stop-daemon --stop --signal INT --quiet \
73
 
            --pidfile $PIDFILE --exec $DAEMON
74
 
        then
75
 
            rm $PIDFILE
76
 
            if start-stop-daemon --start --quiet  \
77
 
                --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS ; then
78
 
                log_end_msg 0
79
 
            else
80
 
                log_end_msg 1
81
 
            fi
82
 
        else
83
 
            log_end_msg 1
84
 
        fi
85
 
        ;;
86
 
    reopen-logs)
87
 
        log_daemon_msg "Reopening $DESC logs" $NAME
88
 
        if start-stop-daemon --stop --signal HUP --oknodo --quiet \
89
 
            --pidfile $PIDFILE --exec $DAEMON
90
 
        then
91
 
            log_end_msg 0
92
 
        else
93
 
            log_end_msg 1
94
 
        fi
95
 
        ;;
96
 
    restart)
97
 
        check_syntax
98
 
        $0 stop
99
 
        $0 start
100
 
        ;;
101
 
    status)
102
 
        status_of_proc -p "$PIDFILE" "$DAEMON" lighttpd && exit 0 || exit $?
103
 
        ;;
104
 
    *)
105
 
        echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2
106
 
        exit 1
107
 
        ;;
108
 
esac
109
 
 
110
 
exit 0