summaryrefslogtreecommitdiff
blob: 41cb16f04aec0070e01637e9a8a634d74d14c4fb (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
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: $

checkconfig() {
	if [ -z "${DIDIWIKIHOME}" ] || [ -z "${DIDIWIKIUSER}" ] || [ -z "${DIDIWIKIGROUP}" ] ; then
		eerror "Please edit /etc/conf.d/didiwiki and set DIDIWIKIHOME,"
		eerror "DIDIWIKIUSER and DIDIWIKIGROUP to valid settings."
		return 1
	fi
	if [ "${DIDIWIKIUSER}" == "root" ]; then
		eerror "DIDIWIKIUSER should not be root!"
		return 1
	fi
	return 0
}

start() {
	checkconfig || return $?

	export DIDIWIKIHOME
	ebegin "Starting didiwiki with HOME=${DIDIWIKIHOME}, USER=${DIDIWIKIUSER}, GROUP=${DIDIWIKIGROUP}"
	start-stop-daemon --quiet --chuid ${DIDIWIKIUSER}:${DIDWIKIGROUP} --start --pidfile /var/run/didiwiki.pid --background --make-pidfile --exec /usr/bin/didiwiki
	eend $?
}

stop() {
	ebegin "Stopping didiwiki" 
	start-stop-daemon --quiet --stop --name didiwiki --exec /usr/bin/didiwiki
	eend $?
}