aboutsummaryrefslogtreecommitdiff
path: root/www/trafficserver/files/trafficserver.in
blob: daa2ede69867e2d3c4663c47714473d733b525c2 (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
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: trafficserver
# REQUIRE: LOGIN
# KEYWORD: shutdown

. /etc/rc.subr

rcvar=trafficserver_enable
name="trafficserver"
trafficserver_enable=${trafficserver_enable:-"NO"}
trafficserver_tm_pidfile=${trafficserver_tm_pidfile:-"/usr/local/var/trafficserver/manager.lock"}
trafficserver_ts_pidfile=${trafficserver_ts_pidfile:-"/usr/local/var/trafficserver/server.lock"}
pidfile="/var/run/traffic_cop.lock"
stop_cmd="trafficserver_stop"
command=/usr/sbin/daemon
command_args="-p ${pidfile} %%PREFIX%%/bin/traffic_cop"
procname="%%PREFIX%%/bin/traffic_cop"

trafficserver_stop()
{
	if [ -f ${pidfile} ]; then
		kill `cat ${pidfile}`
		rm -f ${pidfile}
	fi

	if [ -f ${trafficserver_tm_pidfile} ]; then
		kill `cat ${trafficserver_tm_pidfile}`
		rm -f ${trafficserver_tm_pidfile}
	fi

	if [ -f ${trafficserver_ts_pidfile} ]; then
		kill `cat ${trafficserver_ts_pidfile}`
		rm -f ${trafficserver_ts_pidfile}
	fi
}

load_rc_config "$name"
run_rc_command "$1"