summaryrefslogtreecommitdiffhomepage
path: root/modules/base/root/sbin/luci-reload
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-06-11 13:29:05 +0000
committerJo-Philipp Wich <jow@openwrt.org>2014-06-11 13:29:05 +0000
commit7043c30e0e55bbbfacdddf97619b6bae96d20ddb (patch)
treeece3254350b3ba01ba3135caed2364cc7ca7804c /modules/base/root/sbin/luci-reload
parentbbb44cf245c11bc0c1d59e836007c9e8c3bfa209 (diff)
build: introduce luci-base
Merges libs/core, libs/ipkg, libs/web, libs/sys, libs/sgi-cgi, libs/sgi-uhttpd, modules/admin-core, themes/base and protcols/core into modules/base and renames luci-lib-core to luci-base.
Diffstat (limited to 'modules/base/root/sbin/luci-reload')
-rwxr-xr-xmodules/base/root/sbin/luci-reload45
1 files changed, 45 insertions, 0 deletions
diff --git a/modules/base/root/sbin/luci-reload b/modules/base/root/sbin/luci-reload
new file mode 100755
index 0000000000..cc41da2bb7
--- /dev/null
+++ b/modules/base/root/sbin/luci-reload
@@ -0,0 +1,45 @@
+#!/bin/sh
+. /lib/functions.sh
+
+apply_config() {
+ config_get init "$1" init
+ config_get exec "$1" exec
+ config_get test "$1" test
+
+ echo "$2" > "/var/run/luci-reload-status"
+
+ [ -n "$init" ] && reload_init "$2" "$init" "$test"
+ [ -n "$exec" ] && reload_exec "$2" "$exec" "$test"
+}
+
+reload_exec() {
+ local service="$1"
+ local ok="$3"
+ set -- $2
+ local cmd="$1"; shift
+
+ [ -x "$cmd" ] && {
+ echo "Reloading $service... "
+ ( $cmd "$@" ) 2>/dev/null 1>&2
+ [ -n "$ok" -a "$?" != "$ok" ] && echo '!!! Failed to reload' $service '!!!'
+ }
+}
+
+reload_init() {
+ [ -x /etc/init.d/$2 ] && /etc/init.d/$2 enabled && {
+ echo "Reloading $1... "
+ /etc/init.d/$2 reload >/dev/null 2>&1
+ [ -n "$3" -a "$?" != "$3" ] && echo '!!! Failed to reload' $1 '!!!'
+ }
+}
+
+lock "/var/run/luci-reload"
+
+config_load ucitrack
+
+for i in $*; do
+ config_foreach apply_config $i $i
+done
+
+rm -f "/var/run/luci-reload-status"
+lock -u "/var/run/luci-reload"