Setting to put NAS into Standby automatically

Got a feature request? Great! Post your ideas here!
User avatar
Gunthor
Posts: 116
youtube meble na wymiar Warszawa
Joined: Sun Jun 23, 2013 6:04 pm
Location: Germany - Stuttgart

Setting to put NAS into Standby automatically

Post by Gunthor »

Yesterday I got my new Asustor AS-604RS.

WOL is working. But in order use WOL regularly the NAS has to be in Sleep mode or must be shut down. So I am looking for the setting to tell the NAS the idle network minutes in order to go into sleep mode automatically! So far I manually use the Buttons "Sleep" and "Shut Down" above the "Sign out" button within the Administration Interface (ACC). I am sure there is an automatic way to have the NAS do the job on its own (Power Scheduling is no option for me because the machine is used irregularly). Could someone help me with that?
Last edited by Gunthor on Thu Jul 11, 2013 6:00 am, edited 1 time in total.
Since 07/2023: Asustor AS6702T, (2 x Seagate IronWolf 12TB, RAID 1)
Old: Asustor AS-604RS, ADM 3.1.2.RHG1 (4 x WD Red WD30EFRX 3TB, RAID 5)
sys
Posts: 188
Joined: Thu Jun 14, 2012 8:13 pm

Re: Setting to put NAS into Standby automatically

Post by sys »

I think it is kind of difficult to have this because the NAS will always have packets in and out since you will have quite some service running on it. Under the setting/Energy Saver, I think that is the best you can choose from for hard drives to go to sleep instead of the system...

Asustor may correct me if I am wrong.
User avatar
Gunthor
Posts: 116
Joined: Sun Jun 23, 2013 6:04 pm
Location: Germany - Stuttgart

Re: Setting to put NAS into Standby automatically

Post by Gunthor »

I was afraid to get this kind of answer - because I couldn't find the sought for option. If someone knows a third party app that offers the configuration of an automatic shut down depending on network activity PLEASE post them here...
I think offering the WOL function w/o an automatic shut down or stand by is of little use when it comes to energy saving ambitions...

Is here someone who runs WHS on her/his Asustor machine? Is this possible? Or to be more specific: Can I install Windows Home Server on my AS-604 RS? Then I could install the "apps" I am missing - e.g. the automatic shut down Manager from EnviProt...
Since 07/2023: Asustor AS6702T, (2 x Seagate IronWolf 12TB, RAID 1)
Old: Asustor AS-604RS, ADM 3.1.2.RHG1 (4 x WD Red WD30EFRX 3TB, RAID 5)
User avatar
Gunthor
Posts: 116
Joined: Sun Jun 23, 2013 6:04 pm
Location: Germany - Stuttgart

Re: Setting to put NAS into Standby automatically

Post by Gunthor »

This is not the solution - only a workaround (I hope that a future Asustor firmware update will offer more setting options in this direction) with SSH.

I wrote a script (NAS_Shutdown_Example.vbs) that is called by another script (Hibernate.vbs), deployed it on all machines of my little network, adjusted the IP addresses of the "other" NAS clients and use Hibernate.vbs to put them into hibernation mode.

What the script does: It checks if other NAS clients are still online - and if not it will power down the NAS machine as well. This way the last user longer needs to log into the web interface to manually shutdown the NAS server. :P

This is the code for NAS_Shutdown_Example.vbs:

Code: Select all

'Last one turns out the light (NAS)

Dim NAS_Client(1)
Dim NAS_Host
Dim NAS_Port

'List other network clients here
NAS_Client(0) = "192.168.220.101" 
NAS_Client(1) = "192.168.220.102" 
'Enter IP address of your NAS here
NAS_Host = "192.168.220.100"
NAS_Port = "22"

Dim Shell
Set Shell = CreateObject("WScript.Shell")

'Check if NAS is online
Dim Exec
Dim Result
Dim NAS_Online

Set Exec = Shell.Exec("ping -n 1 -w 2000 " & NAS_Host)
Results = LCase(Exec.StdOut.ReadAll)
NAS_Online = (InStr(Results, "antwort von") > 0)

If NAS_Online Then
	'Check for other NAS clients
	Dim PingSuccess
	For Each IP_Address In NAS_Client
		Set Exec = Shell.Exec("ping -n 1 -w 2000 " & IP_Address)
		Results = LCase(Exec.StdOut.ReadAll)
		PingSuccess = (InStr(Results, "antwort von") > 0)
		If PingSuccess Then Exit For
	Next
End If
Set Exec = Nothing

If NAS_Online And Not PingSuccess Then
	'Shutdown NAS
	Shell.Run ("H:\PortApps\Kitty\kitty_portable.exe -ssh " & NAS_Host & " " & NAS_Port)
	WScript.Sleep 2000
	Shell.SendKeys ("root" &vbcr)
	WScript.Sleep 500
	Shell.SendKeys ("TypeYourPasswordHere" &vbcr)
	WScript.Sleep 500
	Shell.SendKeys ("poweroff" &vbcr)
	WScript.Sleep 500
	Shell.SendKeys("{ENTER}")
	Shell.SendKeys ("exit" &vbcr)
End If

If WScript.Arguments.Count = 0 Then
    WScript.Echo "Client will not shutdown."
	WScript.Echo "Missing shutdown parameter!"
Else
	'Shutdown client
	Select Case Wscript.Arguments(0)
		Case "Shutdown"
			Shell.Run ("%windir%\System32\shutdown.exe -s")
		Case "Logoff"
			Shell.Run ("%windir%\System32\shutdown.exe -l")
		Case "Reboot"
			Shell.Run ("%windir%\System32\shutdown.exe -r")
		Case "Standby"
			Shell.Run ("%windir%\System32\Rundll32.exe powrprof.dll,SetSuspendState Standby")
		Case "Hibernate"
			Shell.Run ("%windir%\System32\Rundll32.exe powrprof.dll,SetSuspendState Hibernate")
	End Select
End If
Set Shell = Nothing
This is the code for Hibernate.vbs:

Code: Select all

Dim Shell
Set Shell = Wscript.CreateObject("WScript.Shell")

Shell.Run """H:\_HW\Asustor AS-604RS\Shutdown\NAS_Shutdown.vbs "" Hibernate"

Set Shell = Nothing
Since 07/2023: Asustor AS6702T, (2 x Seagate IronWolf 12TB, RAID 1)
Old: Asustor AS-604RS, ADM 3.1.2.RHG1 (4 x WD Red WD30EFRX 3TB, RAID 5)