mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
nut: Use 'real' procd for nut-cgi
Even though nut-cgi doesn't run a daemon, using procd triggers is helpful for updating the generated config file when the UCI config changes. So implement this and 'modernize' nut-cgi initscript Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
#
|
#
|
||||||
START=51
|
START=51
|
||||||
|
USE_PROCD=1
|
||||||
|
|
||||||
DEFAULT=/etc/default/nut
|
DEFAULT=/etc/default/nut
|
||||||
UPSCGI_C=/var/etc/nut/hosts.conf
|
UPSCGI_C=/var/etc/nut/hosts.conf
|
||||||
@@ -42,10 +43,10 @@ nut_upscgi_add() {
|
|||||||
echo "MONITOR $system \"$displayname\"" >> $UPSCGI_C
|
echo "MONITOR $system \"$displayname\"" >> $UPSCGI_C
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
service_reload() {
|
||||||
rm -f $UPSCGI_C
|
|
||||||
rm -f "$UPSCGI_S"
|
|
||||||
mkdir -m 0755 -p "$(dirname "$UPSCGI_C")"
|
mkdir -m 0755 -p "$(dirname "$UPSCGI_C")"
|
||||||
|
rm -f "$UPSCGI_C"
|
||||||
|
rm -f "$UPSCGI_S"
|
||||||
|
|
||||||
config_load nut_cgi
|
config_load nut_cgi
|
||||||
|
|
||||||
@@ -55,9 +56,16 @@ start() {
|
|||||||
chmod 640 /var/etc/nut/hosts.conf
|
chmod 640 /var/etc/nut/hosts.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
start_service() {
|
||||||
rm -f $UPSCGI_C
|
service_reload
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_service() {
|
||||||
|
rm -f "$UPSCGI_C"
|
||||||
rm -f "$UPSCGI_S"
|
rm -f "$UPSCGI_S"
|
||||||
ln -sf /etc/nut/upsset.conf.disable "$UPSCGI_S"
|
ln -sf /etc/nut/upsset.conf.disable "$UPSCGI_S"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
service_triggers() {
|
||||||
|
procd_add_reload_trigger "nut_cgi"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user