diff options
author | Steven Barth <steven@midlink.org> | 2008-09-23 23:06:11 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-09-23 23:06:11 +0000 |
commit | c94ef7f8d3a71afc2d713f584c9ef7cb71e45861 (patch) | |
tree | fc699c3dc6d3bee7a7266c4747ecfd951b1cf964 /libs/uci/root | |
parent | a67aea40a0e362b6d737540bd0bf966fcb671bfc (diff) |
Optimize return value checks for luci-reload
Diffstat (limited to 'libs/uci/root')
-rwxr-xr-x | libs/uci/root/sbin/luci-reload | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libs/uci/root/sbin/luci-reload b/libs/uci/root/sbin/luci-reload index b1479947b..b6b1ff6ce 100755 --- a/libs/uci/root/sbin/luci-reload +++ b/libs/uci/root/sbin/luci-reload @@ -4,22 +4,25 @@ apply_config() { config_get init "$1" init config_get exec "$1" exec + config_get test "$1" test - [ -n "$init" ] && reload_init "$2" "$init" - [ -n "$exec" ] && reload_exec "$2" "$exec" + [ -n "$init" ] && reload_init "$2" "$init" "$test" + [ -n "$exec" ] && reload_exec "$2" "$exec" "$test" } reload_exec() { [ -x $2 ] && { echo "Reloading $1... " - $2 >/dev/null 2>&1 || echo "!!! Failed to reload $1 !!!" + $2 >/dev/null 2>&1 + [ -n "$3" -a "$?" != "$3" ] && echo '!!! Failed to reload' $1 '!!!' } } reload_init() { [ -x /etc/init.d/$2 ] && /etc/init.d/$2 enabled && { echo "Reloading $1... " - /etc/init.d/$2 reload >/dev/null 2>&1 || echo "!!! Failed to reload $1 !!!" + /etc/init.d/$2 reload >/dev/null 2>&1 + [ -n "$3" -a "$?" != "$3" ] && echo '!!! Failed to reload' $1 '!!!' } } @@ -28,4 +31,4 @@ config_load ucitrack for i in $* do config_foreach apply_config $i $i -done
\ No newline at end of file +done |