Updates to rc.apcupsd

This commit is contained in:
SimonFair
2024-07-03 21:39:51 +01:00
parent f4a8bf0d81
commit 45d71932a1
+16 -4
View File
@@ -14,17 +14,24 @@
DAEMON="APC-UPS Power Management"
APCPID="/var/run/apcupsd.pid"
LOCK="/var/lock/apcupsd"
APCUPS_SETTINGS="/boot/config/plugins/dynamix.apcupsd/dynamix.apcupsd.cfg"
# run & log functions
. /etc/rc.d/rc.runlog
# Read Unraid configuration
[[ -f $APCUPS_SETTINGS ]] && . $APCUPS_SETTINGS
apcupsd_running(){
sleep 0.1
[[ -f $APCPID ]]
}
apcupsd_start(){
log "Starting $DAEMON..."
if [ "$SERVICE" != "enabled" ]; then
log "Start disabled by comfig.";
exit;
fi
local REPLY
rm -f /etc/apcupsd/powerfail /etc/nologin
if apcupsd_running; then
@@ -57,9 +64,14 @@ apcupsd_stop(){
apcupsd_restart(){
log "Restarting $DAEMON..."
apcupsd_stop
sleep 1
apcupsd_start
if apcupsd_running; then
apcupsd_stop
sleep 1
apcupsd_start
else
REPLY="Not running"
log "$DAEMON... $REPLY."
fi
}
apcupsd_status(){