aboutsummaryrefslogtreecommitdiff
path: root/net/prosody/files/prosody.init
blob: 9829862d238303259768b2996326d290c1124aeb (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
#!/bin/sh /etc/rc.common
# Copyright (C) 2011-2016 OpenWrt.org

START=99

USE_PROCD=1

BIN=/usr/bin/prosodyctl
LOG_D=/var/log/prosody
RUN_D=/var/run/prosody
PID_F=$RUN_D/prosody.pid
RUN_USER=prosody
RUN_GROUP=prosody

start_service() {
	[ -d /var/run/prosody ] || {
		mkdir -m 0755 -p /var/run/prosody
		chown prosody:prosody /var/run/prosody
	}
	[ -d /var/log/prosody ] || {
		mkdir -m 0755 -p /var/log/prosody
		chown prosody:prosody /var/log/prosody
	}

	[ -d /var/log/prosody ] && {
		chown -R root:prosody /etc/prosody
		chown -R prosody:prosody /etc/prosody/data
	}

	[ -f /sbin/paxctl ] && {
		paxctl  -v /usr/bin/ > /dev/null  2>&1	
		[ $? -ne 0 ] && {
			cp /usr/bin/lua /tmp
			paxctl -c -m /tmp/lua
			cp -f /tmp/lua /usr/bin/lua
		}
	}

	procd_open_instance
	procd_set_param command "$BIN" start
	procd_set_param file /etc/prosody/prosody.cfg.lua
	procd_close_instance
}

stop_service() {
	${BIN} stop
}