summaryrefslogtreecommitdiff
blob: 9d111fe181a1e1390c606a599b4c1eb9debb779e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/sbin/runscript
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

HOPEXEC=/usr/bin/hop
HOPUSER=hop
HOPHOME=/var/www
PIDFILE=/var/run/hop.pid
LOGFILE=/var/log/hop

# For user extensions through /etc/conf.d/hop
HOP_OPTS="--log-file ${LOGFILE} ${HOP_OPTS}"

depend() {
    need localmount net
}

logfile() {
    if [ ! -f ${LOGFILE} ]
    then
	touch ${LOGFILE}
    fi
    chown ${HOPUSER} ${LOGFILE} || eerror "Cannot create logfile"
    return 0
}

start() {
    logfile || return 1

    ebegin "Starting Hop Web Broker"
    start-stop-daemon --start --oknodo \
	--background --chuid ${HOPUSER} \
	--make-pidfile --pidfile ${PIDFILE} \
        --exec ${HOPEXEC} --env HOME=${HOPHOME} \
	-- ${HOP_OPTS}
    eend $?
}

stop() {
    ebegin "Stopping Hop Web Broker"
    start-stop-daemon --stop \
	--exec ${HOPEXEC} --pidfile ${PIDFILE}
    eend $?
}