mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
42 lines
1.1 KiB
Bash
Executable file
42 lines
1.1 KiB
Bash
Executable file
#!/bin/sh /etc/rc.common
|
|
# XMPP client software
|
|
# Copyright (C) 2020 iopsys Software Solutions AB
|
|
# Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
|
|
|
START=99
|
|
STOP=10
|
|
|
|
USE_PROCD=1
|
|
PROG="/usr/sbin/xmppd"
|
|
|
|
start_service() {
|
|
local xmpp_enable=`uci -q get xmpp.xmpp.enable`
|
|
local xmpp_id=`uci -q get xmpp.xmpp.id`
|
|
if ([ "$xmpp_enable" = "1" ] && [ "$xmpp_id" != "0" ]); then
|
|
local con=`uci show xmpp | grep "xmpp.@connection.*xmpp_id=\'$xmpp_id\'" | cut -d "." -f 2`
|
|
local con_srv=`uci show xmpp | grep "xmpp.@connection.*con_id=\'$xmpp_id\'" | cut -d "." -f 2`
|
|
local serveralgorithm=`uci get xmpp.$con.serveralgorithm`
|
|
local con_enable=`uci -q get xmpp.$con.enable`
|
|
local srv_enable=`uci -q get xmpp.$con_srv.enable`
|
|
if ([ "$serveralgorithm" = "DNS-SRV" ] && [ "$con_enable" = "1" ]) || ([ "$serveralgorithm" = "ServerTable" ] && [ "$con_enable" = "1" ] && [ "$srv_enable" = "1" ]); then
|
|
procd_open_instance
|
|
procd_set_param command "$PROG"
|
|
procd_set_param respawn "3" "7" "0"
|
|
procd_close_instance
|
|
fi
|
|
fi
|
|
}
|
|
|
|
boot() {
|
|
start
|
|
}
|
|
|
|
reload_service() {
|
|
stop
|
|
start
|
|
}
|
|
|
|
service_triggers()
|
|
{
|
|
procd_add_reload_trigger xmpp
|
|
}
|