blob: 48486eb12f654cbb3370bfcdedc4f341fd150543 (
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
|
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-im/jabberd/files/jabberd-2.1.6.init,v 1.1 2007/06/07 09:17:37 nelchael Exp $
depend() {
need net
use mysql postgresql slapd
provide jabber-server
}
function stopJabberServices() {
eindent
for pidfile in /var/run/jabber/*.pid; do
if [[ -f "${pidfile}" ]]; then
service=$(basename ${pidfile/.pid/})
ebegin "Stopping ${service}"
start-stop-daemon \
--stop \
--pidfile ${pidfile}
eend $?
fi
done
eoutdent
}
start() {
einfo "Starting Jabber Server ..."
local services=$(grep -v ^# /etc/jabber/jabberd.cfg | grep '..*' | awk '{print $1 ":" $2}')
eindent
for service in ${services}; do
cfgfile=${service/*:/}
service=${service/:*/}
if [[ ! -f "${cfgfile}" ]]; then
if [[ -f "/etc/jabber/${service}.xml" ]]; then
cfgfile="/etc/jabber/${service}.xml"
else
eerror "Can't find: ${cfgfile} or default /etc/jabber/${service}.xml"
stopJabberServices
return 1
fi
fi
executable=/usr/bin/${service}
if [[ ! -f "${executable}" ]]; then
eerror "Can't find executable: ${executable}"
stopJabberServices
return 1
fi
ebegin "Starting ${service} (${cfgfile})"
start-stop-daemon \
--background \
--start \
--chuid jabber:jabber \
--exec /usr/bin/${service} \
-- -c ${cfgfile}
eend $?
done
eoutdent
}
stop() {
einfo "Stopping Jabber Server"
stopJabberServices
}
|