summaryrefslogtreecommitdiff
path: root/games/ldmud/files/ldmud.in
blob: 08d76bd8eabf623b694a37cf7c842bf1f2980000 (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
#!/bin/sh

# PROVIDE: ldmud
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add ldmud_enable=yes to /etc/rc.conf.local or /etc/rc.conf to enable ldmud

. /etc/rc.subr

name=ldmud
ldmud_user=mud
rcvar=ldmud_enable

start_cmd="${name}_start"

command="%%PREFIX%%/sbin/${name}"
rundir="/var/run/${name}"
pidfile="${rundir}/${name}.pid"
logfile="/var/log/${name}/${name}.log"

load_rc_config ${name}
: ${ldmud_enable="NO"}

ldmud_start()
{
	if checkyesno ldmud_enable
	then
		echo "Starting ${name}."
		/usr/sbin/daemon -u "${ldmud_user}" -p "${pidfile}" \
			/bin/sh -c "${command} > ${logfile} 2>&1"
	fi
}

run_rc_command "$1"