summaryrefslogtreecommitdiff
blob: 321cc56a1af4986795a83ab9915805a76256f7f1 (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
46
47
48
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/sguil-server/files/sguild.initd,v 1.1 2005/10/08 14:01:29 strerror Exp $



[ -z "${CONF}" ] && CONF="/etc/sguil/sguild.conf"
[ -z "${AUTOCAT}" ] && AUTOCAT="/etc/sguil/autocat.conf"
[ -z "${QUERIES}" ] && QUERIES="/etc/sguil/sguild.queries"
[ -z "${USERS}" ] && USERS="/etc/sguil/sguild.users"
[ -z "${ACCESS}" ] && AUTOCAT="/etc/sguil/sguild.access"

SGUILD_OPTS="-D -c ${CONF} -u ${USERS} -A ${ACCESS}"

[ -n "${OPENSSLPATH}" ] && SGUILD_OPTS="${SGUILD_OPTS} -o -C ${OPENSSLPATH}"

depend() {
	need net
	use mysql
}

checkconfig() {
	
	[ -f "${CONF}" ] || return 1	
	[ -f "${AUTOCAT}" ] || return 1	
	[ -f "${QUERIES}" ] || return 1
	[ -f "${USERS}" ] || return 1
	[ -f "${ACCESS}" ] || return 1
	if [ -n "${OPENSSLPATH}" ]; then
		[ -f "${OPENSSLPATH}/sguild.key" ] || return 1
		[ -f "${OPENSSLPATH}/sguild.pem" ] || return 1
	fi
}

start() {
	checkconfig || return 1
	ebegin "Starting sguild"
	start-stop-daemon --start --quiet -c sguil --exec /usr/bin/sguild \
		-- ${SGUILD_OPTS} ${EXTRA_SGUILD_OPTS} -D -P /var/run/sguil/sguild.pid
	eend $?
}

stop() {
	ebegin "Stopping sguild"
	start-stop-daemon --stop --quiet --pidfile /var/run/sguil/sguild.pid
	eend $?
}