libs: remove http folder
[project/luci.git] / libs / uci / root / sbin / luci-reload
1 #!/bin/sh
2 . /etc/functions.sh
3
4 apply_config() {
5 config_get init "$1" init
6 config_get exec "$1" exec
7 config_get test "$1" test
8
9 echo "$2" > "/var/run/luci-reload-status"
10
11 [ -n "$init" ] && reload_init "$2" "$init" "$test"
12 [ -n "$exec" ] && reload_exec "$2" "$exec" "$test"
13 }
14
15 reload_exec() {
16 [ -x $2 ] && {
17 echo "Reloading $1... "
18 $2 >/dev/null 2>&1
19 [ -n "$3" -a "$?" != "$3" ] && echo '!!! Failed to reload' $1 '!!!'
20 }
21 }
22
23 reload_init() {
24 [ -x /etc/init.d/$2 ] && /etc/init.d/$2 enabled && {
25 echo "Reloading $1... "
26 /etc/init.d/$2 reload >/dev/null 2>&1
27 [ -n "$3" -a "$?" != "$3" ] && echo '!!! Failed to reload' $1 '!!!'
28 }
29 }
30
31 lock "/var/run/luci-reload"
32
33 config_load ucitrack
34
35 for i in $*; do
36 config_foreach apply_config $i $i
37 done
38
39 rm -f "/var/run/luci-reload-status"
40 lock -u "/var/run/luci-reload"