68 lines
1.2 KiB
Bash
Executable File
68 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
. /etc/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() {
|
|
[ -x $2 ] && {
|
|
echo "Reloading $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
|
|
[ -n "$3" -a "$?" != "$3" ] && echo '!!! Failed to reload' $1 '!!!'
|
|
}
|
|
}
|
|
|
|
avahi_stop() {
|
|
[ -s /var/run/avahi-daemon/pid ] && {
|
|
AVAHI=1
|
|
/etc/init.d/avahi-daemon stop
|
|
}
|
|
}
|
|
|
|
avahi_start() {
|
|
[ -n $AVAHI ] && /etc/init.d/avahi-daemon start
|
|
}
|
|
|
|
flukso_stop() {
|
|
[ -s /var/run/fluksod/pid ] && {
|
|
FLUKSO=1
|
|
/etc/init.d/flukso stop
|
|
}
|
|
}
|
|
|
|
flukso_start() {
|
|
[ -n $FLUKSO ] && /etc/init.d/flukso start
|
|
}
|
|
|
|
|
|
lock "/var/run/luci-reload"
|
|
avahi_stop
|
|
flukso_stop
|
|
|
|
config_load ucitrack
|
|
|
|
for i in $*; do
|
|
config_foreach apply_config $i $i
|
|
done
|
|
|
|
flukso_start
|
|
avahi_start
|
|
rm -f "/var/run/luci-reload-status"
|
|
lock -u "/var/run/luci-reload"
|