openwrt-wan-failover/wan-failover.init.d

32 lines
688 B
Bash
Executable File

#!/bin/sh /etc/rc.common
#
# Copyright (c) Brian Tarricone <brian@tarricone.org>
# Released under the terms of the BSD 3-clause license.
# See https://opensource.org/licenses/BSD-3-Clause for details.
START=99
USE_PROCD=1
PROG=/usr/sbin/wan-failover
reload_service() {
json_init
json_add_array interfaces
for i in $(load_ifaces); do
json_add_string "" "$i"
done
json_close_array
ubus call umdns set_config "$(json_dump)"
}
start_service() {
procd_open_instance
procd_set_param command "$PROG"
procd_set_param respawn
procd_open_trigger
procd_add_config_trigger "config.change" "wan-failover" /etc/init.d/wan-failover restart
procd_close_trigger
procd_close_instance
}