mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 07:28:39 +01:00
Merge pull request #6655 from cshoredaniel/pr-fix-nut-upsmon-no-server
nut: Fix for nut-upsmon without nut-server
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=nut
|
PKG_NAME:=nut
|
||||||
PKG_VERSION:=2.7.4
|
PKG_VERSION:=2.7.4
|
||||||
PKG_RELEASE:=6
|
PKG_RELEASE:=7
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.7/
|
PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.7/
|
||||||
|
|||||||
@@ -126,8 +126,11 @@ nut_upsmon_add() {
|
|||||||
local password
|
local password
|
||||||
local system
|
local system
|
||||||
|
|
||||||
# If no core config, use defaults
|
# if UPSMON_C is a symlink we're only doing generated config
|
||||||
[ -r $UPSMON_C ] || nut_upsmon_conf ""
|
[ -L $UPSMON_C ] && {
|
||||||
|
rm -f $UPSMON_C
|
||||||
|
nut_upsmon_conf ""
|
||||||
|
}
|
||||||
|
|
||||||
config_get upsname "$cfg" upsname
|
config_get upsname "$cfg" upsname
|
||||||
config_get hostname "$cfg" hostname localhost
|
config_get hostname "$cfg" hostname localhost
|
||||||
@@ -143,7 +146,8 @@ nut_upsmon_add() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
start_service() {
|
start_service() {
|
||||||
rm -f $UPSMON_C
|
mkdir -p "$(dirname "$UPSMON_C")"
|
||||||
|
chmod 750 "$(dirname "$UPSMON_C")"
|
||||||
|
|
||||||
config_load nut_monitor
|
config_load nut_monitor
|
||||||
|
|
||||||
@@ -156,20 +160,22 @@ start_service() {
|
|||||||
chmod 640 $UPSMON_C
|
chmod 640 $UPSMON_C
|
||||||
chmod 640 /var/etc/nut/nut.conf
|
chmod 640 /var/etc/nut/nut.conf
|
||||||
|
|
||||||
|
chown ${runas:-root}:$(id -gn ${runas:-root}) /var/etc/nut
|
||||||
|
chown ${runas:-root}:$(id -gn ${runas:-root}) /var/etc/nut/nut.conf
|
||||||
|
chown ${runas:-root}:$(id -gn ${runas:-root}) $UPSMON_C
|
||||||
|
|
||||||
[ -d /var/run/nut ] || {
|
[ -d /var/run/nut ] || {
|
||||||
mkdir -m 0750 -p /var/run/nut
|
mkdir -m 0750 -p /var/run/nut
|
||||||
chown ${runas:-root}:$(id -gn ${runas:-root}) /var/run/nut
|
chown ${runas:-root}:$(id -gn ${runas:-root}) /var/run/nut
|
||||||
}
|
}
|
||||||
|
|
||||||
chown ${runas:-root}:$(id -gn ${runas:-root}) $UPSMON_C
|
exec $DEBUG /usr/sbin/upsmon $UPSMON_OPTIONS
|
||||||
$DEBUG /usr/sbin/upsmon $UPSMON_OPTIONS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_service() {
|
stop_service() {
|
||||||
[ -r $PID_F ] && /usr/sbin/upsmon -c stop
|
exec /usr/sbin/upsmon -c stop
|
||||||
rm -f $UPSMON_C
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reload_service() {
|
reload_service() {
|
||||||
upsmon -c reload
|
exec /usr/sbin/upsmon -c reload
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user