summaryrefslogtreecommitdiff
path: root/www/wcol/files/wcol.sh.sample
blob: b3e0772a046d6bc99fe9649c37327fd1b1bf60c5 (plain) (blame)
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
49
50
#!/bin/sh
#
# Startup for wcol daemon
#

# default settings.
wcol_program=@@PREFIX@@/wcol/wcol
wcol_kill_program=@@PREFIX@@/wcol/killwcol
wcol_conf=@@PREFIX@@/etc/wcol.conf
wcol_spooldir=@@DEFAULT_POOLDIR@@
wcol_pid=/var/run/wcol.pid

#
# If there is a global system configuration file, suck it in.
#
if [ -f /etc/defaults/rc.conf ]; then
	. /etc/defaults/rc.conf
elif [ -f /etc/rc.conf ]; then
	. /etc/rc.conf
fi

case "$1" in
'start')
	if [ "x${wcol_enable}"  = "xYES" ] ; then
		if [ -f ${wcol_conf} -a -f ${wcol_program} ]; then
			if [ ! -d ${wcol_spooldir} ]; then
				/bin/mkdir ${wcol_spooldir}
			fi
			${wcol_program} >/dev/null 2>&1 &
			echo -n ' wcol'
		fi
	fi
	;;
'stop')
	if [ -f ${wcol_kill_program} ]; then
		${wcol_kill_program} >/dev/null 2>&1
	else 
		PID=`cat ${wcol_pid}`
		if [ ! -z "$PID" ] ;  then
			/bin/kill ${PID} >/dev/null 2>&1
		fi
		/bin/rm -f ${wcol_pid}
	fi
	;;
*)
	echo "Usage: wcol.sh { start | stop }"
	;;
esac

exit 0