mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-14 07:43:06 +00:00
0e8c34c0e9
- Ensure ejabberd can find its files PR: ports/96675 Poked by: Denis Shaposhnikov Submitted by: maintainer
76 lines
1.5 KiB
Bash
76 lines
1.5 KiB
Bash
#! /bin/sh
|
|
# $FreeBSD$
|
|
|
|
# PROVIDE: ejabberd
|
|
# REQUIRE: DAEMON
|
|
# BEFORE: LOGIN
|
|
# KEYWORD: shutdown
|
|
|
|
# Define these ejabberd_* variables in one of these files:
|
|
# /etc/rc.conf
|
|
# /etc/rc.conf.local
|
|
# /etc/rc.conf.d/ejabberd
|
|
#
|
|
# DO NOT CHANGE THESE DEFAULT VALUES HERE
|
|
#
|
|
ejabberd_enable="${ejabberd_enable-NO}"
|
|
|
|
. %%RC_SUBR%%
|
|
|
|
name=ejabberd
|
|
rcvar=`set_rcvar`
|
|
|
|
reload_cmd="ejabberd_reload"
|
|
restart_cmd="ejabberd_reload"
|
|
start_cmd="ejabberd_start"
|
|
status_cmd="ejabberd_status"
|
|
stop_cmd="ejabberd_stop"
|
|
|
|
cd %%PREFIX%% # Why is this needed!?
|
|
|
|
# Include ejabberd defaults if available
|
|
[ -f %%PREFIX%%/etc/ejabberd/ejabberd.defaults ] && . %%PREFIX%%/etc/ejabberd/ejabberd.defaults
|
|
|
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin:%%PREFIX%%/bin:%%PREFIX%%/sbin
|
|
EJABBERD=%%PREFIX%%/bin/ejabberd
|
|
EJABBERDCTL=%%PREFIX%%/bin/ejabberdctl
|
|
EJABBERDUSER=ejabberd
|
|
|
|
ejabberd_status()
|
|
{
|
|
su $EJABBERDUSER -c "$EJABBERDCTL ejabberd@`hostname -s` status >/dev/null"
|
|
}
|
|
|
|
ejabberd_start()
|
|
{
|
|
echo -n "Starting $name: "
|
|
su $EJABBERDUSER -c "$EJABBERD -s -noshell -detached"
|
|
echo "$name."
|
|
}
|
|
|
|
ejabberd_stop()
|
|
{
|
|
echo -n "Stopping $name: "
|
|
if su $EJABBERDUSER -c "$EJABBERDCTL ejabberd@`hostname -s` stop"; then
|
|
sleep 2
|
|
killall -u ejabberd -kill
|
|
else
|
|
echo -n " failed "
|
|
fi
|
|
echo "$name."
|
|
}
|
|
|
|
ejabberd_reload()
|
|
{
|
|
echo -n "Restarting $name: "
|
|
if ejabberd_status; then
|
|
su $EJABBERDUSER -c "$EJABBERDCTL ejabberd@`hostname -s` restart"
|
|
else
|
|
ejabberd_start
|
|
fi
|
|
echo "$name."
|
|
}
|
|
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|