You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

40 lines
913 B

#!/bin/sh /etc/rc.common
START=85
USE_PROCD=1
trm_script="/usr/bin/travelmate.sh"
boot()
{
ubus -t 30 wait_for network.interface
rc_procd start_service
}
start_service()
{
if [ $(/etc/init.d/travelmate enabled; printf ${?}) -eq 0 ]
then
procd_open_instance "travelmate"
procd_set_param command "${trm_script}" "${@}"
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
fi
}
service_triggers()
{
local iface="$(uci -q get travelmate.global.trm_iface)"
if [ -z "${iface}" ]
then
procd_add_raw_trigger "interface.*.down" 1000 /etc/init.d/travelmate start
else
for name in ${iface}
do
procd_add_interface_trigger "interface.*.down" "${name}" /etc/init.d/travelmate start
done
fi
procd_add_config_trigger "config.change" "travelmate" /etc/init.d/travelmate start
}