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