Newer
Older

Amin Ben Ramdhane
committed
#!/bin/sh /etc/rc.common
START=99
STOP=10
USE_PROCD=1

Amin Ben Ramdhane
committed
stop_service() {
xmpp_running="$(ubus call service list '{"name":"xmppc"}' | jq ".xmppc.instances.instance1.running")"
if [ "${xmpp_running}" = "true" ]; then
procd_send_signal xmppc '*' SIGKILL
fi
if [ -f "/var/state/xmppc" ]; then
uci -q -c /var/state delete xmppc.conn_status
uci -q -c /var/state commit xmppc
fi

Amin Ben Ramdhane
committed
start_service() {
local con_name=$(uci -q get xmpp.xmpp.conn_req_connection)
local con_enable=$(uci -q get xmpp."${con_name}".enable)
if [ ! -f "/var/state/xmppc" ]; then
touch "/var/state/xmppc"
fi
uci -q -c /var/state set xmppc.global='global'
uci -q -c /var/state set xmppc.global.last_change="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
uci -q -c /var/state commit xmppc

Amin Ben Ramdhane
committed
fi

Amin Ben Ramdhane
committed
}
reload_service() {

Amin Ben Ramdhane
committed
stop
start
}
service_triggers()
{
procd_add_reload_trigger xmpp
}