summaryrefslogtreecommitdiffhomepage
path: root/libs/uci/root/sbin/luci-reload
blob: a92c6eb7fa505789a0fed47b805424fe2c369e5a (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
#!/bin/sh
. /etc/functions.sh

apply_config() {
	config_get init "$1" init
	config_get exec "$1" exec
	
	[ -n "$init" ] && reload_init "$2" "$init"
	[ -n "$exec" ] && reload_exec "$2" "$exec"
}

reload_exec() {
	[ -x $2 ] && {
		echo -n "Reloading $1... "
		$2 >/dev/null 2>&1 && echo "done." || echo "failed!"
	}
}

reload_init() {
	[ -x /etc/init.d/$2 ] && /etc/init.d/$2 enabled && {
		echo -n "Reloading $1... "
		/etc/init.d/$2 reload >/dev/null 2>&1 && echo "done." || echo "failed!" 
	}
}

config_load ucitrack

for i in $*
do
	config_foreach apply_config $i
done