scripts dutchification - batch 2

This commit is contained in:
bergware
2023-10-11 20:44:38 +02:00
parent fee32792f9
commit ef63045632
2 changed files with 58 additions and 11 deletions
+33 -10
View File
@@ -7,31 +7,42 @@
# LimeTech - modified for Unraid OS
# Bergware - modified for Unraid OS, October 2023
DAEMON="ACPI daemon"
DAEMON="ACPI power management daemon"
# run & log functions
. /etc/rc.d/rc.runlog
acpid_running(){
ps axc | grep -q ' acpid'
}
acpid_start(){
log "Starting $DAEMON..."
local REPLY
if [[ -x /usr/sbin/acpid && -d /proc/acpi ]]; then
run /usr/sbin/acpid
REPLY="Started"
if acpid_running; then
REPLY="Already started"
else
REPLY="Failed"
if [[ -d /proc/acpi ]]; then
run /usr/sbin/acpid
if acpid_running; then REPLY="Started"; else REPLY="Failed"; fi
else
REPLY="No ACPI present"
fi
fi
log "$DAEMON... $REPLY."
}
acpid_stop(){
log "Stopping $DAEMON..."
if [[ -r /var/run/acpid.pid ]]; then
kill $(cat /var/run/acpid.pid)
local REPLY
if ! acpid_running; then
REPLY="Already stopped"
else
killall acpid
run kill $(cat /var/run/acpid.pid 2>/dev/null)
run killall acpid
if ! acpid_running; then REPLY="Stopped"; else REPLY="Failed"; fi
fi
log "$DAEMON... Stopped."
log "$DAEMON... $REPLY."
}
acpid_restart(){
@@ -41,6 +52,15 @@ acpid_restart(){
acpid_start
}
acpid_status(){
if acpid_running; then
echo "$DAEMON is currently running."
else
echo "$DAEMON is not running."
exit 1
fi
}
case "$1" in
'start')
acpid_start
@@ -51,8 +71,11 @@ case "$1" in
'restart')
acpid_restart
;;
'status')
acpid_status
;;
*)
echo "Usage: $BASENAME start|stop|restart"
echo "Usage: $BASENAME start|stop|restart|status"
exit 1
esac
exit 0
+25 -1
View File
@@ -93,6 +93,27 @@ ip_forward_restart(){
ip_forward_start
}
ip_forward_status(){
if [[ -f $SYSTEM/ipv4/ip_forward ]]; then
if [[ $(cat $SYSTEM/ipv4/ip_forward) == 1 ]]; then
echo "IPv4 packet forwarding is enabled."
else
echo "IPv4 packet forwarding is disabled."
fi
else
echo "IPv4 packet forwarding is not present."
fi
if [[ -f $SYSTEM/ipv6/conf/all/forwarding ]]; then
if [[ $(cat $SYSTEM/ipv6/conf/all/forwarding) == 1 ]]; then
echo "IPv6 packet forwarding is enabled."
else
echo "IPv6 packet forwarding is disabled."
fi
else
echo "IPv6 packet forwarding is not present."
fi
}
case "$1" in
'start')
ip_forward_start
@@ -103,8 +124,11 @@ case "$1" in
'restart')
ip_forward_restart
;;
'status')
ip_forward_status
;;
*)
echo "Usage: $BASENAME start|stop|restart"
echo "Usage: $BASENAME start|stop|restart|status"
exit 1
esac
exit 0