Files
webgui/etc/rc.d/rc.acpid
T
2023-10-04 19:32:06 +02:00

59 lines
868 B
Bash
Executable File

#!/bin/bash
#
# script: rc.acpid
#
# Start/stop/restart acpid.
#
# LimeTech - modified for Unraid OS
# Bergware - modified for Unraid OS, October 2023
DAEMON="ACPI daemon"
# run & log functions
. /etc/rc.d/rc.runlog
acpid_start(){
log "Starting $DAEMON..."
local REPLY
if [[ -x /usr/sbin/acpid && -d /proc/acpi ]]; then
run /usr/sbin/acpid
REPLY="Started"
else
REPLY="Failed"
fi
log "$DAEMON... $REPLY."
}
acpid_stop(){
log "Stopping $DAEMON..."
if [[ -r /var/run/acpid.pid ]]; then
kill $(cat /var/run/acpid.pid)
else
killall acpid
fi
log "$DAEMON... Stopped."
}
acpid_restart(){
log "Restarting $DAEMON..."
acpid_stop
sleep 1
acpid_start
}
case "$1" in
'start')
acpid_start
;;
'stop')
acpid_stop
;;
'restart')
acpid_restart
;;
*)
echo "Usage: $BASENAME start|stop|restart"
exit 1
esac
exit 0