diff --git a/net/nut/files/nut-monitor.init b/net/nut/files/nut-monitor.init index 56c12c0ae..f094a82ba 100755 --- a/net/nut/files/nut-monitor.init +++ b/net/nut/files/nut-monitor.init @@ -6,11 +6,13 @@ UPSMON_C=/var/etc/nut/upsmon.conf nut_upsmon_conf() { local cfg="$1" + local RUNAS val optval echo "# Config file automatically generated from UCI config" > "$UPSMON_C" - config_get runas "$cfg" runas - [ -n "$runas" ] && echo "RUN_AS_USER $runas" >> $UPSMON_C + config_get RUNAS "$cfg" runas + [ -n "$RUNAS" ] && echo "RUN_AS_USER $RUNAS" >> "$UPSMON_C" + runas="$RUNAS" config_get val "$cfg" minsupplies 1 echo "MINSUPPLIES $val" >> "$UPSMON_C" @@ -143,7 +145,6 @@ nut_upsmon_add() { } build_config() { - local runas mkdir -m 0750 -p "$(dirname "$UPSMON_C")" config_load nut_monitor @@ -162,6 +163,7 @@ build_config() { } start_service() { + local runas local havemon havems build_config @@ -178,6 +180,7 @@ start_service() { reload_service() { if pgrep upsmon >/dev/null 2>/dev/null; then + local runas build_config /usr/sbin/upsmon -c reload else