#!/bin/sh /etc/rc.common

START=99
USE_PROCD=1

get_config() {
	config_get_bool enabled $1 enabled 1
	config_get_bool logger $1 logger 0
	config_get token $1 token
}

start_service() {
	config_load ddnsto
	config_foreach get_config ddnsto
	[ $enabled != 1 ] && return 1
	if [ -z "$token" ]; then
		logger -t ddnsto -p warn "token not set"
		return 1
	fi

	procd_open_instance
	procd_set_param command /usr/sbin/ddnsto -u "$token"
	[ "$logger" == 1 ] && procd_set_param stderr 1
	procd_set_param respawn
	procd_close_instance
}
