1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-25 04:43:33 +00:00
freebsd-ports/net-im/prosody/files/prosody.in
2014-06-04 22:56:34 +00:00

50 lines
947 B
Bash

#!/bin/sh
# $FreeBSD$
#
# PROVIDE: prosody
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# prosody_enable (bool): Set to NO by default.
# Set it to YES to enable Prosody
. /etc/rc.subr
name="prosody"
rcvar=prosody_enable
command="%%PREFIX%%/bin/prosodyctl"
load_rc_config $name
prosody_enable=${prosody_enable:-"NO"}
pidfile=${prosody_pidfile:-"%%PREFIX%%/var/lib/prosody/prosody.pid"}
extra_commands="status"
start_cmd="prosody_start"
stop_cmd="prosody_cmd stop"
restart_cmd="$stop_cmd; $start_cmd"
status_cmd="prosody_cmd status"
prosody_start()
{
config="%%PREFIX%%/etc/prosody/prosody.cfg.lua"
if grep -q '^daemonize[[:blank:]]*=[[:blank:]]*false' $config; then
# Prosody's not going to daemonize on its own, use daemon(8)
daemon $command start
else
$command start
fi
}
prosody_cmd()
{
$command $1
}
run_rc_command "$1"