mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
8d260c02fb
Marshall T. Rose) SVN Revision: 136
74 lines
1.4 KiB
Bash
74 lines
1.4 KiB
Bash
#!/bin/sh
|
|
#
|
|
# PROVIDE: ejabberd
|
|
# REQUIRE: DAEMON
|
|
# KEYWORD: shutdown
|
|
#
|
|
|
|
HOME=/usr/pkg/jabber D=/usr/pkg/jabber/ejabberd export HOME
|
|
|
|
name="ejabberd"
|
|
rcvar=$name
|
|
|
|
if [ -r /etc/rc.conf ]
|
|
then
|
|
. /etc/rc.conf
|
|
else
|
|
eval ${rcvar}=YES
|
|
fi
|
|
|
|
# $flags from environment overrides ${rcvar}_flags
|
|
if [ -n "${flags}" ]
|
|
then
|
|
eval ${rcvar}_flags="${flags}"
|
|
fi
|
|
|
|
checkyesno()
|
|
{
|
|
eval _value=\$${1}
|
|
case $_value in
|
|
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0 ;;
|
|
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1 ;;
|
|
*)
|
|
echo "\$${1} is not set properly."
|
|
return 1
|
|
;;
|
|
esac
|
|
}
|
|
|
|
cmd=${1:-start}
|
|
case ${cmd} in
|
|
force*)
|
|
cmd=${cmd#force}
|
|
eval ${rcvar}=YES
|
|
;;
|
|
esac
|
|
|
|
if checkyesno ${rcvar}
|
|
then
|
|
else
|
|
exit 0
|
|
fi
|
|
|
|
case ${cmd} in
|
|
start)
|
|
if [ -x $D/src ]; then
|
|
echo "Starting ${name}."
|
|
cd $D/src
|
|
su jabber -c "/usr/pkg/bin/erl -sname ejabberd -s ejabberd -heart -detached &" \
|
|
1>/dev/null 2>&1
|
|
fi
|
|
;;
|
|
stop)
|
|
echo "rpc:call('ejabberd@`hostname -s`', init, stop, [])." | \
|
|
su jabber -c "erl -sname ejabberdstop"
|
|
;;
|
|
restart)
|
|
echo "rpc:call('ejabberd@`hostname -s`', init, restart, [])." | \
|
|
su jabber -c "erl -sname ejabberdrestart"
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart}"
|
|
exit 1
|
|
esac
|