#!/bin/sh /etc/rc.common
|
|
|
|
START=85
|
|
USE_PROCD=1
|
|
|
|
trm_init="/etc/init.d/travelmate"
|
|
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)"
|
|
|
|
for name in ${iface}
|
|
do
|
|
procd_add_interface_trigger "interface.*.down" "${name}" "${trm_init}" start
|
|
done
|
|
procd_add_config_trigger "config.change" "travelmate" "${trm_init}" start
|
|
}
|