Unlikely a script...devilman wrote: if somebody shows me what script is triggert after 30minutes of idle to spin down the hdd
Suspend (sleep or hibernate) when IDLE
- schumaku
- Guru
- Posts: 43578
- Joined: Mon Jan 21, 2008 4:41 pm
- Location: Kloten (Zurich), Switzerland -- Skype: schumaku
- Contact:
Re: Suspend (sleep or hibernate) when IDLE
-
- New here
- Posts: 5
- Joined: Thu Jul 16, 2015 10:54 pm
Auto Hibernate/Sleep
Requesting a tool for letting the NAS go into SLEEP-Mode, when specific ip-adresses are not pingable and there is no active Connection to the nas..........
Is there someone out..... who can write a qpkg like this will reward
Missing the feature since i changed my zyxel nas with the qnap one ;( ....... it was available via 3rd Party apps on zyxel
Is there someone out..... who can write a qpkg like this will reward
Missing the feature since i changed my zyxel nas with the qnap one ;( ....... it was available via 3rd Party apps on zyxel
- schumaku
- Guru
- Posts: 43578
- Joined: Mon Jan 21, 2008 4:41 pm
- Location: Kloten (Zurich), Switzerland -- Skype: schumaku
- Contact:
Re: Auto Hibernate/Sleep
Since the ZyXEL NSA2400 (Via based x86), all newer ZyXEL NAS220/320/325/325v2 were based on Marvell Kirkwood (same as the QNAP TS-x10/x12/x19/x20/x21) resp. ZyXEL NAS520/540 based on Comcerto 2000 EVM (same as QNAP TS-x31 Series [not the TS-x31+]) - none of these hardware architectures support ACPI power modes - so no G1 sleep states like the four S1 through S4 ones.
Should you mix up HDD spin-down (ZyXEL names this [HDD] hibernation) with the ACPI G1-S3 sleep state QNAP offers on most newer Intel/AMD based NAS models?
Should you mix up HDD spin-down (ZyXEL names this [HDD] hibernation) with the ACPI G1-S3 sleep state QNAP offers on most newer Intel/AMD based NAS models?
-
- New here
- Posts: 5
- Joined: Thu Jul 16, 2015 10:54 pm
Re: Auto Hibernate/Sleep
Ok ur right on NSA325v2 it shutted down ..... and wokeup via WOL within a Minute......
but the Feature was very cool.....
SO THE TITLE CAULD BE
AUTO Hibernate/Sleep/Shutdown
but the Feature was very cool.....
SO THE TITLE CAULD BE
AUTO Hibernate/Sleep/Shutdown
- pwilson
- Guru
- Posts: 22533
- Joined: Fri Mar 06, 2009 11:20 am
- Location: Victoria, BC, Canada (UTC-08:00)
Re: Auto Hibernate/Sleep
Your NAS can already do HDD standby mode:Biatsch wrote:Ok ur right on NSA325v2 it shutted down ..... and wokeup via WOL within a Minute......
but the Feature was very cool.....
SO THE TITLE CAULD BE
AUTO Hibernate/Sleep/Shutdown
Similarly the NAS already supports WOL:
Patrick M. Wilson
Victoria, BC Canada
QNAP TS-470 Pro w/ 4 * Western Digital WD30EFRX WD Reds (RAID5) - - Single 8.1TB Storage Pool FW: QTS 4.2.0 Build 20151023 - Kali Linux v1.06 (64bit)
Forums: View My Profile - Search My Posts - View My Photo - View My Location - Top Community Posters
QNAP: Turbo NAS User Manual - QNAP Wiki - QNAP Tutorials - QNAP FAQs
Please review: When you're asking a question, please include the following.
-
- New here
- Posts: 5
- Joined: Thu Jul 16, 2015 10:54 pm
Re: Auto Hibernate/Sleep
pwilson wrote:Your NAS can already do HDD standby mode:Biatsch wrote:Ok ur right on NSA325v2 it shutted down ..... and wokeup via WOL within a Minute......
but the Feature was very cool.....
SO THE TITLE CAULD BE
AUTO Hibernate/Sleep/Shutdown
Similarly the NAS already supports WOL:
Seems u didnt understand the function i want ....... ;(
i dont want to power down only the hdds ... i want the System to go to suspend so that the fan is off !!!!!!!!!!!
it´s only possible via power shedule or app and i would like to have it automatically
- pwilson
- Guru
- Posts: 22533
- Joined: Fri Mar 06, 2009 11:20 am
- Location: Victoria, BC, Canada (UTC-08:00)
Re: Auto Hibernate/Sleep
There is always something running on the NAS, so it will never enter this state automatically.
I simply spent $20 and upgraded my Fan to a Silent one. Works like a charm even when forced to full speed I can't hear it from across the room.
My poor NAS is seldom idle. During my waking hours I use it constantly, and when I'm sleeping it is busy doing my Backups.
I simply spent $20 and upgraded my Fan to a Silent one. Works like a charm even when forced to full speed I can't hear it from across the room.
My poor NAS is seldom idle. During my waking hours I use it constantly, and when I'm sleeping it is busy doing my Backups.
Patrick M. Wilson
Victoria, BC Canada
QNAP TS-470 Pro w/ 4 * Western Digital WD30EFRX WD Reds (RAID5) - - Single 8.1TB Storage Pool FW: QTS 4.2.0 Build 20151023 - Kali Linux v1.06 (64bit)
Forums: View My Profile - Search My Posts - View My Photo - View My Location - Top Community Posters
QNAP: Turbo NAS User Manual - QNAP Wiki - QNAP Tutorials - QNAP FAQs
Please review: When you're asking a question, please include the following.
-
- New here
- Posts: 5
- Joined: Thu Jul 16, 2015 10:54 pm
Re: Auto Hibernate/Sleep
I could be forced
Wilson the noise is not my Problem ....... i want the nas in sleepmode (so the nas isnt pingable but should fast awake via macadress )
In the german Forum someone wrote an qpkg but it isnt shared anymore ;((( http://forum.qnapclub.de/viewtopic.php? ... t=shutdown
So it seems there is no one out who can program a function like that...... (check if some ips are not pingable and a samba share is not used to get the nas into sleepmode)?????
Wilson the noise is not my Problem ....... i want the nas in sleepmode (so the nas isnt pingable but should fast awake via macadress )
In the german Forum someone wrote an qpkg but it isnt shared anymore ;((( http://forum.qnapclub.de/viewtopic.php? ... t=shutdown
So it seems there is no one out who can program a function like that...... (check if some ips are not pingable and a samba share is not used to get the nas into sleepmode)?????
-
- New here
- Posts: 8
- Joined: Mon Mar 07, 2016 2:52 am
Re: Suspend (sleep or hibernate) when IDLE
This thread is quite old but if you still haven't found a solution - this might help you.
I use the following cron job which has been set to execute every 5 mins. Every time the hard drives switch to standby mode, the script will trigger a static status mail to my account, sync its time settings and then send the whole NAS to standby mode, thus switching off the drives, fan and the NAS itself - resulting in total silence . "Reviving" the NAS via wake-on-LAN usually takes less than 15 secs.
My TS-469 Pro's configuration:
[*] Wake-on-LAN active
[*] HDD spindown after 30 mins of inactivity
[*] QTS 4.2.0
This is the script that I have cron execute every 5 mins. I check on the status of drives sda-sdd as my NAS has 4 physical drives (your miles may vary). If the number of active drives turns zero, NTP-Update (for 2FA) & sendmail are triggered. Finally, the command sends the device to sleep.
sleepmail.txt:
Keep in mind that there needs to be an empty line of text between the message's body and the "to" line.
crontab excerpt:
Caveats:
[*] I'd like to fire up an email whenever the NAS awakes from sleep. Not sure how to detect this 'safely'.
[*] If drives sda-sdd go to sleep, they will spin down and the NAS' fan stays active. The moment the script recognizes that the NAS can now go to sleep, all hard drives will however become active again for a brief period of time. Ideally, you'd like to detect that the drives are almost close to spinning down and then have that cron job send it to sleep, thus avoiding the additional spin up of those drives. I am not sure how to detect this either.
Best,
Joerg
I use the following cron job which has been set to execute every 5 mins. Every time the hard drives switch to standby mode, the script will trigger a static status mail to my account, sync its time settings and then send the whole NAS to standby mode, thus switching off the drives, fan and the NAS itself - resulting in total silence . "Reviving" the NAS via wake-on-LAN usually takes less than 15 secs.
My TS-469 Pro's configuration:
[*] Wake-on-LAN active
[*] HDD spindown after 30 mins of inactivity
[*] QTS 4.2.0
This is the script that I have cron execute every 5 mins. I check on the status of drives sda-sdd as my NAS has 4 physical drives (your miles may vary). If the number of active drives turns zero, NTP-Update (for 2FA) & sendmail are triggered. Finally, the
Code: Select all
echo mem >/sys/power/state
Code: Select all
#!/bin/bash
lines=`hdparm -C /dev/sd[a-d]|grep "active/idle"|wc -l|tr -d ' '|cut -f1 -d' '`
if [ $lines == "0" ]; then
cat /etc/config/sleepmail.txt|sendmail -t
ntpdate time.euro.apple.com 2>/dev/null >/dev/null
hwclock --systohc
sleep 30
echo mem >/sys/power/state
fi
Code: Select all
Subject: Going to sleep
From: QNAP NAS
To: [i]<recipient's email>[/i]
going to sleep in 30 secs ....
crontab excerpt:
Code: Select all
# m h dom m dow cmd
*/5 * * * * /etc/config/send_nas_to_sleep_if_idle.sh
Caveats:
[*] I'd like to fire up an email whenever the NAS awakes from sleep. Not sure how to detect this 'safely'.
[*] If drives sda-sdd go to sleep, they will spin down and the NAS' fan stays active. The moment the script recognizes that the NAS can now go to sleep, all hard drives will however become active again for a brief period of time. Ideally, you'd like to detect that the drives are almost close to spinning down and then have that cron job send it to sleep, thus avoiding the additional spin up of those drives. I am not sure how to detect this either.
Best,
Joerg
-
- Starting out
- Posts: 18
- Joined: Wed May 11, 2016 8:50 pm
Re: Suspend (sleep or hibernate) when IDLE
Hello Joerg,
This is exactly what I have been looking for.
Would you be available for a PM if I have any questions?
Thx,
BB
This is exactly what I have been looking for.
Would you be available for a PM if I have any questions?
Thx,
BB
- schumaku
- Guru
- Posts: 43578
- Joined: Mon Jan 21, 2008 4:41 pm
- Location: Kloten (Zurich), Switzerland -- Skype: schumaku
- Contact:
Re: Suspend (sleep or hibernate) when IDLE
Reminder: Subject are the ACPI S3 (sleep) and S4 (hibernate, writing memory content to the HDD) modes - not HDD spin-down.
-
- New here
- Posts: 8
- Joined: Mon Mar 07, 2016 2:52 am
Re: Suspend (sleep or hibernate) when IDLE
Hey BB - scripts should be self-explanatory but feel free to send me a PM in case of questions (there might be a delay with my response, though).
FWIW: the script works fine for me for more than 2 months. Remaining obscables (for me) include:
[*] I still haven't figured out how to detect that the HDD's are on the verge of spindown, thus allowing me to send the whole NAS to sleep (HDD's and the whole remaining shebang such as fan, motherboard etc) without experiencing an additional HDD spinup-spindown situation before the device ultimately goes to sleep.
[*] If you expose the NAS to the Internet and you have both script and wake-on-LAN activated, you will experience cases where the NAS will revive from sleep (e.g. triggered through a port scan). For me, this happens 5-10 times per day. In order to avoid this, you'll either need to disable the exposed WOL or use e.g. knockd on a Raspberry which is then responsible for waking up your NAS.
Best,
Joerg
FWIW: the script works fine for me for more than 2 months. Remaining obscables (for me) include:
[*] I still haven't figured out how to detect that the HDD's are on the verge of spindown, thus allowing me to send the whole NAS to sleep (HDD's and the whole remaining shebang such as fan, motherboard etc) without experiencing an additional HDD spinup-spindown situation before the device ultimately goes to sleep.
[*] If you expose the NAS to the Internet and you have both script and wake-on-LAN activated, you will experience cases where the NAS will revive from sleep (e.g. triggered through a port scan). For me, this happens 5-10 times per day. In order to avoid this, you'll either need to disable the exposed WOL or use e.g. knockd on a Raspberry which is then responsible for waking up your NAS.
Best,
Joerg
-
- Starting out
- Posts: 18
- Joined: Wed May 11, 2016 8:50 pm
Re: Suspend (sleep or hibernate) when IDLE
Joerg,
Happy to say that your script works like a charm.
The only thing which is not working is the mail notification. Do I have to make the sleepmail.txt an executable through the chmod command in order for it to fly?
Would really be great if Qnap would activate this functionality in a future release.
Many thx,
BB
Happy to say that your script works like a charm.
The only thing which is not working is the mail notification. Do I have to make the sleepmail.txt an executable through the chmod command in order for it to fly?
Would really be great if Qnap would activate this functionality in a future release.
Many thx,
BB
-
- New here
- Posts: 8
- Joined: Mon Mar 07, 2016 2:52 am
Re: Suspend (sleep or hibernate) when IDLE
BB - my pleasure
As suggested by the file extension, that sleepmail.txt is a plain text file. As long as that file is readable, there shouldn't be an issue. You do however need to have the QNAP system's email settings properly configured (via Web UI) - otherwise, it's not going to work.
Best,
Joerg
As suggested by the file extension, that sleepmail.txt is a plain text file. As long as that file is readable, there shouldn't be an issue. You do however need to have the QNAP system's email settings properly configured (via Web UI) - otherwise, it's not going to work.
Best,
Joerg
-
- Starting out
- Posts: 18
- Joined: Wed May 11, 2016 8:50 pm
Re: Suspend (sleep or hibernate) when IDLE
As well as this script works, I am wondering if there could be a better way of triggering it than via the HD standby state?
My problem remains that the chances of my HD's spinning down to Standby is like winning the jackpot in Vegas... Even after installing the latest firmware, I am finding myself spending a lot of time just trying to convince them to spin down although I am certain that user connectivity is not what is hindering them.
Does anyone have an idea how to trigger this script based upon something like number of sessions opened = 0 ? (or similar)
My problem remains that the chances of my HD's spinning down to Standby is like winning the jackpot in Vegas... Even after installing the latest firmware, I am finding myself spending a lot of time just trying to convince them to spin down although I am certain that user connectivity is not what is hindering them.
Does anyone have an idea how to trigger this script based upon something like number of sessions opened = 0 ? (or similar)