aboutsummaryrefslogtreecommitdiff
path: root/www/aolserver/files/aolserver.sh.in
blob: 09363bab12dd177d2b5b806fb8c65d6826f776b5 (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
#! /bin/sh
#
#
# PROVIDE: aolserver
# REQUIRE: DAEMON NETWORKING SERVERS
#
# Add the following line to /etc/rc.conf to enable aolserver:
#
# aolserver_enable="YES"
#
# Tweakable parameters for users to override in rc.conf

aolserver_enable="${aolserver_enable-NO}"
aolserver_home=%%PREFIX%%/aolserver
aolserver_conf=${aolserver_home}/sample-config.tcl 
aolserver_flags="-u nobody -g nobody"
aolserver_prog=${aolserver_home}/bin/nsd

. "%%RC_SUBR%%"

name=aolserver
load_rc_config ${name}
pid=`ps -ax | grep ${aolserver_conf} | grep -v grep| awk -F' ' '{print $1}'`
rcvar=`set_rcvar`
required_files=${aolserver_conf}
command=${aolserver_prog}
procname=${aolserver_prog}

stop_cmd="if [ ! -z \"${pid}\" ] ; then \
		echo \"Notice: stopping aolserver.... Kill -TERM ${pid}\" ; \
		kill -TERM ${pid} ; \
	else \
		echo \"Notice: No aolserver process found. Nothing to stop.\" ; \
	fi"
start_cmd="if [ ! -z \"${pid}\" ] ; then \
		echo \"Notice: aolserver is already running.\"; \
	else \
		echo \"Notice: starting aolserver.......\" ; \
		echo \"Issuing command: ${command} -t ${aolserver_conf} ${aolserver_flags} \" ; \
		${command} -t ${aolserver_conf} ${aolserver_flags}; \
	fi"
status_cmd="if [ ! -z \"${pid}\" ] ; then \
		echo \"Notice: aolserver is running with pid ${pid}\" ; \
	else \
		echo \"Notice: aolserver is not running\" ; \
	fi"

run_rc_command "$1"