Awes0meM4n Awes0meM4n - 1 year ago 54
Bash Question

Using "Deep Sleep" / "Power Saving" mode through SSH in NAS OS?

I'm an user of a LACIE 2-BIG-NAS. Until the NAS OS version I had the "Deep Sleep" option in the Home menu, but after the next upgrade this option was removed.
I tried to downgrade to the previous version following the manual steps but it was not able, only upgrades are available.
I asked to the support service of Lacie but the their solution is to backup my data and do a fresh install and upgrade until This isn't a solution from my point of view.

Now I tried to get into deep sleep mode from a SSH conection because NAS OS is a linux-based SO. I tried all the posibilities with initng command (sudo ngc -0 and -1) which is used by the NAS OS, but it's imposible to wake on lan the NAS (the OS powers off but no answer from the wake-on-lan request).

The code for wake on lan is correct because when I schedule the deep sleep mode I can do it, but I don`t know how to get deep sleep mode on-demand.

I googled and try other options but I think these were the closest to the solution.

Please, can you help me to find the correct ssh command line to get the deep sleep mode in the Lacie 2-big-nas?

Best regards.

Answer Source

I found the solution in cron. There is a scheduled command in /sbin/smart_shutdown so, if you execute that script as root, the 2-big-nas go into the Deep sleep mode.

This is the content of the script "smart_shutdown":

# This script is intended to handle a user shutdown request.  
# It will probably (but not necesseraly) called from a crontab.  


valid_runlevels="shutdown halt sleep reboot"




  for valid in ${valid_runlevels}; do  
    [ "${req_runlevel}" = "${valid}" ] && return 0

  logger "smart_shutdown: request invalid runlevel ${req_runlevel}"
  return 1  

  dbus-send --system --dest=com.lacie.Unicorn --type=method_call --print-reply --reply-timeout=1000 /com/lacie/Unicorn com.lacie.Unicorn.switch_runlevel string:"$1"

if [ ! -z "$1" ]; then 
  check_runlevel "$1" || exit 1

request_runlevel ${runlevel}

exit 0  

I hope you can take advantage of this in the future.