I just installed 5.0-beta6a with the s3.sh.
I dont need s2ram because my Mobo doesn't has any issues.
The only thing is that the script i use here normally uses s2ram to let the server go to S3.
Now i tried to change that to echo 3 > /proc/acpi/sleep, but this does not exist.
What i found what works is echo "mem" /sys/power/state, is that the right line to power down my unRaid server?
The script would look like this (Line 145 chnaged)
#!/bin/bash
# constants
yes="yes"
no="no"
# [CONFIGURATION]
# before going to sleep
intrnlTimeoutTicks=2 # ticks after HDD spindown before checking for external activity
extrnlTimeoutTicks=1 # ticks of no external activity before sleep; only after spindown+internal countdown
# control of internal timeout
checkHDDs=$yes # check if all HDDs are parked before counting down towards sleep
noCountdownHours="" # only countdown towards sleep outside these hours
# example: <noCountdownHours="07 08 19 20">
# always countdown: <noCountdownHours="">
# control of external timeout
checkTCP=$no # check for TCP activity
pingIPs="" # do not sleep if <$pingsIPs> are pingable
# example: <pingIPs="192.168.1.4 192.168.1.5">
# no ping-check: <pingIPs="">
# after waking up from sleep
doDhcpRenewal=$no # <$no> for servers w/static IP address
forceGb=$yes # might not be needed; probably always safe
# [/CONFIGURATION]
# implementation stuff
ticklengthSecs=60 # probe hardware + count down every minute/60secs, aka a tick
noTCP='0.00' # what constitutes absence of TCP activity
flash=/dev/`ls -l /dev/disk/by-label| grep UNRAID | cut -d"/" -f3 | cut -c 1-3` # automatic id of flash drive
check_hour() {
echo $(date +%H)
}
check_HDD_activity() {
if [ $checkHDDs = $yes ]
then
# probe the flash drive at your peril
HDDs=$((for d in $(ls /dev/[hs]d? | grep -v "$flash"); do hdparm -C $d | grep active ; done) | wc -l)
else
HDDs=0
fi
echo $HDDs
}
check_TCP_activity() {
if [ "$checkTCP" = $yes ]
then
TCP=$(bwm-ng -o csv -c 1 -d 0 -T avg | grep eth0 | cut -d";" -f5)
else
TCP="$noTCP"
fi
echo "$TCP"
}
check_IP_status() {
mp_online=$no # initialize to "no" until we learn otherwise
# ping each of the media servers to determine if online
for i in $pingIPs
do
# ping the media server; if it answers, it is online
out=`ping -q -c 1 $i 2>/dev/null`
rec_count=`echo "$out" | grep received | cut -d " " -f4`
if [ "$rec_count" -eq 1 ]
then
mp_online=$yes
# if one is online, we do not need to ping
# any others, break out of the "for" loop.
break;
fi
done
echo $mp_online
}
pre_sleep_activity() {
/usr/local/sbin/mover
echo $(date) Mover Complete
sleep 5
/bin/sync
echo $(date) Sync Complete
}
post_sleep_activity() {
echo $(date) Resumed from sleep
# Force NIC to use gigabit networking
if [ "$forceGb" = $yes ]
then
ethtool -s eth0 speed 1000
echo $(date) Network set to Gb
fi
# Force a DHCP renewal (shouldn't be used for static-ip boxes)
if [ "$doDhcpRenewal" = $yes ]
then
/sbin/dhcpcd -n
fi
echo $(date) unRAID Server Online
}
# main
echo $(date) Starting S3 script
intrnlCountdown=$intrnlTimeoutTicks
extrnlCountdown=$extrnlTimeoutTicks
while [ 1 ]
do
# do not countdown during certain hours
hour=`check_hour`
hourMatch=$(echo "$noCountdownHours" | grep "$hour" | wc -l)
if [ $hourMatch -eq 0 ]
then
# count number of HDDs that are not parked
HDDact=`check_HDD_activity`
if [ "$HDDact" -eq 0 ]
then
# tick-tock for time since last spindown
if [ $intrnlCountdown -gt 0 ]
then
intrnlCountdown=$[$intrnlCountdown-1]
fi
else
# reset countdown, following HDD activity
intrnlCountdown=$intrnlTimeoutTicks
extrnlCountdown=$extrnlTimeoutTicks
fi
if [ $intrnlCountdown -le 0 ]
then
# check for persistent external activity
TCPact=`check_TCP_activity`
IPping=`check_IP_status`
if [ "$TCPact" = $noTCP -a "$IPping" = $no ]
then
if [ $extrnlCountdown -le 0 ]
then
# Do pre-sleep activities
pre_sleep_activity
sleep 5
# Go to sleep
echo $(date) Going to sleep NOW!
echo $(date) unRAID Server Offline
echo "mem" > /sys/power/state
# Do post-sleep activities
post_sleep_activity
sleep 5
intrnlCountdown=$intrnlTimeoutTicks
extrnlCountdown=$extrnlTimeoutTicks
else
# tick-tock for persistent external activity
if [ $extrnlCountdown -gt 0 ]
then
extrnlCountdown=$[$extrnlCountdown-1]
fi
fi
else
# reset countdown, following external activity
extrnlCountdown=$extrnlTimeoutTicks
fi
fi
fi
# Wait a tick
sleep $ticklengthSecs
done