summaryrefslogtreecommitdiff
blob: 20723ab26692a74adc0061334093f24509947db3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/sbin/openrc-run

depend() {
	need localmount
	need net
	use dns
}

checkconfig() {
	if [ ! -f /etc/no-ip2.conf ]
	then
		einfo "Answer the following questions about your no-ip account."
		noip2 -C || return 1
	fi
}

start() {
	checkconfig || return 1
	ebegin "Starting noip"
	start-stop-daemon --quiet --start -x /usr/sbin/noip2 -- -c /etc/no-ip2.conf
	eend $? "noip did not start, error code $?"
}

stop() {
	ebegin "Stopping noip"
	start-stop-daemon --quiet --stop -x /usr/sbin/noip2
	noip_ecode=$?
	eend $noip_ecode "Error stopping the noip daemon, error $noip_ecode"
	checkconfig || return 1
	ebegin "Setting noip addresses to 0.0.0.0"
	noip2 -c /etc/no-ip2.conf -i 0.0.0.0 >/dev/null 2>&1
	eend $? "Failed to set noip addresses to 0.0.0.0, error $?"
	return $noip_ecode
}