blob: 816b7ae886482ebd6aac7770335aecc09f489bf6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#! /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"}
ejabberd_node=${ejabberd_node-"ejabberd@localhost"}
ejabberd_epmd_address=${ejabberd_epmd_address-"127.0.0.1"}
. /etc/rc.subr
name="ejabberd"
rcvar=ejabberd_enable
reload_cmd="ejabberd_reload"
restart_cmd="ejabberd_reload"
start_cmd="ejabberd_start"
status_cmd="ejabberd_status"
stop_cmd="ejabberd_stop"
extra_commands="reload status"
EJABBERDCTL=%%PREFIX%%/sbin/ejabberdctl
EJABBERDUSER=ejabberd
ejabberd_status()
{
if ejabberd_checkstatus; then
echo "$name is running."
else
echo "$name is not running."
return 1
fi
}
ejabberd_checkstatus()
{
su $EJABBERDUSER -c "env ERL_EPMD_ADDRESS=\"${ejabberd_epmd_address}\" $EJABBERDCTL --node $ejabberd_node status > /dev/null"
}
ejabberd_start()
{
echo "Starting $name."
su $EJABBERDUSER -c "env ERL_EPMD_ADDRESS=\"${ejabberd_epmd_address}\" $EJABBERDCTL --node $ejabberd_node start"
}
ejabberd_stop()
{
echo "Stopping $name."
if su $EJABBERDUSER -c "env ERL_EPMD_ADDRESS=\"${ejabberd_epmd_address}\" $EJABBERDCTL --node $ejabberd_node stop"; then
# sleep 2
# killall -u ejabberd -kill
else
_run_rc_notrunning
fi
}
ejabberd_reload()
{
echo "Restarting $name."
if ejabberd_checkstatus; then
su $EJABBERDUSER -c "env ERL_EPMD_ADDRESS=\"${ejabberd_epmd_address}\" $EJABBERDCTL --node $ejabberd_node restart"
else
ejabberd_start
fi
}
load_rc_config $name
run_rc_command "$1"
|