mirror of
https://github.com/unraid/webgui.git
synced 2026-04-21 17:29:28 -05:00
Updates to rc.apcupsd
This commit is contained in:
+16
-4
@@ -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(){
|
||||
|
||||
Reference in New Issue
Block a user