summaryrefslogtreecommitdiff
path: root/server/gentoo/init.d/pracrod.in
blob: e247eb2a9392cf35704ba25337444a793a2ffedb (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
#!/sbin/runscript
# -*- shell-script -*-
# Copyright 2010 Bent Bisballe Nyeng (deva@aasimon.org)
# Distributed under the terms of the GNU General Public License v2

_PROG="Pracrod"
_PREFIX="@prefix@"
_CONF="${_PREFIX}/etc/pracrod.conf"
_BIN="${_PREFIX}/bin/pracrod"
_LOG="/var/log/pracrod.log"
_PID="/var/run/pracrod.pid"

depend() {
    need net
    need postgresql
#    provide pracrod
}

checkconfig() {
    if [ ! -f ${_CONF} ] ; then
	eerror "Please create ${_CONF}. Take a look at ${_CONF}.example"
	return 1
    fi
    return 0
}

start() {
    checkconfig || return $?
    
    ebegin "Starting ${_PROG}"
    start-stop-daemon --start --exec ${_BIN} \
	--pidfile ${_PID} \
	-- --pidfile ${_PID} --config ${_CONF} \
	-D +fixme,+err,+warn,+info --logfile ${_LOG}
    eend $? "Failed to start ${_PROG}"
}

stop() {
    ebegin "Stopping ${_PROG}"
    start-stop-daemon --stop -s INT \
	--pidfile /var/run/${_PID} \
	--exec ${_BIN}
    eend $? "Failed to stop ${_PROG}"
}