freebsd-ports/irc/inspircd/files/inspircd.in
Mark Felder b6dca3abd2 Fix creation of directories in rc script
Submitted by:	gizd
Approved by:	crees (mentor)
MFH:		2014Q1
2014-01-13 16:13:33 +00:00

58 lines
1.5 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: inspircd
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable inspircd:
#
# inspircd_enable="YES"
#
# Other rc.conf variables:
# inspircd_flags="<set as needed>"
#
# inspircd_config="%%ETCDIR%%/inspircd.conf"
# -- path to config file
# inspircd_pidfile="%%INSPIRCD_RUN%%/inspircd.pid"
# -- location of pidfile: must match setting
# in ${inspircd_conffile}
# inspircd_logfile="%%INSPIRCD_LOG%%"
# -- file inspircd writes logs to
#
. /etc/rc.subr
name=inspircd
rcvar=inspircd_enable
load_rc_config ${name}
: ${inspircd_enable:=NO}
: ${inspircd_config="%%ETCDIR%%/inspircd.conf"}
: ${inspircd_pidfile="%%INSPIRCD_RUN%%/inspircd.pid"}
: ${inspircd_user="%%USERS%%"}
: ${inspircd_group="%%GROUPS%%"}
: ${inspircd_logfile="%%INSPIRCD_LOG%%"}
: ${inspircd_flags="${inspircd_flags} --logfile ${inspircd_logfile} --config ${inspircd_config}"}
command=%%PREFIX%%/bin/inspircd
pidfile=${inspircd_pidfile}
required_files=${inspircd_config}
start_precmd=inspircd_prestart
inspircd_prestart()
{
piddir=$(dirname ${inspircd_pidfile})
if [ ! -d ${piddir} ]; then
install -d -m 755 -o ${inspircd_user} -g ${inspircd_group} ${piddir}
fi
logdir=$(dirname ${inspircd_logfile})
if [ ! -d ${logdir} ]; then
install -d -m 755 -o ${inspircd_user} -g ${inspircd_group} ${logdir}
fi
}
run_rc_command "$1"