mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
ea59447230
* examples/mtr/ejabberd: Likewise SVN Revision: 138
74 lines
1.5 KiB
Bash
74 lines
1.5 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 "/usr/pkg/bin/erl -sname ejabberdstop"
|
|
;;
|
|
restart)
|
|
echo "rpc:call('ejabberd@`hostname -s`', init, restart, [])." | \
|
|
su jabber -c "/usr/pkg/bin/erl -sname ejabberdrestart"
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart}"
|
|
exit 1
|
|
esac
|