ports/www/kannel-sqlbox/files/kannel_sqlbox.in
2021-04-06 16:31:13 +02:00

53 lines
1.2 KiB
Bash

#!/bin/sh
# PROVIDE: sqlbox
# REQUIRE: LOGIN bearerbox
# KEYWORD: shutdown
#
# Add these lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# kannel_sqlbox_enable (bool): Set to NO by default.
# Set it to YES to enable kannel_sqlbox.
# kannel_sqlbox_config (path): Set to %%PREFIX%%/etc/kannel.conf
# by default.
. /etc/rc.subr
name=kannel_sqlbox
rcvar=${name}_enable
kannel_piddir="/var/run/kannel"
load_rc_config $name
: ${kannel_sqlbox_enable:="NO"}
: ${kannel_sqlbox_config="%%PREFIX%%/etc/sqlbox.conf"}
: ${kannel_sqlbox_user:="kannel"}
: ${kannel_sqlbox_group:="kannel"}
command="%%PREFIX%%/sbin/run_kannel_box"
start_precmd="${name}_prestart"
extra_commands="reload"
sig_reload=SIGUSR1
pidfile="${kannel_piddir}/${name}.pid"
command_args="--pidfile ${pidfile} %%PREFIX%%/sbin/sqlbox ${kannel_sqlbox_flags} ${kannel_sqlbox_config}"
kannel_sqlbox_prestart()
{
if [ ! -d "${kannel_piddir}" ]; then
install -d -o $kannel_sqlbox_user -g $kannel_sqlbox_group $kannel_piddir
fi
kannel_sqlbox_checkconfig
}
kannel_sqlbox_checkconfig() {
# Config file is required
if [ ! -r ${kannel_sqlbox_config} ]; then
warn "${kannel_sqlbox_config} is not readable."
exit 1
fi
}
run_rc_command "$1"