summaryrefslogtreecommitdiffstats
path: root/main/gross/grossd.initd
blob: c300ac4982f641fffe78bd3f8cdb78b57bdae8ac (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
#!/sbin/runscript

NAME="grossd"
DAEMON="/usr/sbin/$NAME"
DAEMON_USER="gross"
DAEMON_GROUP="gross"
pidfile=/var/run/gross/$NAME.pid

depend() {
	need net
	after firewall
}

check_config() {
	if [ ! -f /var/db/gross/state ] ; then
		einfo "Generating Gross database..."
		install -dD -o${DAEMON_USER} -g${DAEMON_GROUP} /var/db/gross
		${DAEMON} -Cu ${DAEMON_USER} > /dev/null
	fi
}

start() {
	check_config || return 1
	ebegin "Starting ${NAME}"
	start-stop-daemon --start --quiet --pidfile ${pidfile} \
		--exec ${DAEMON} -- \
		-p ${pidfile} -u ${DAEMON_USER} ${OPTS}
	eend $?
}

stop() {
	ebegin "Stopping ${NAME}"
	start-stop-daemon --stop --exec ${DAEMON}
	eend $?
}