Author Topic: Linkstation Mini + Linux  (Read 10530 times)

Diskdoc

  • Calf
  • *
  • Posts: 4
Linkstation Mini + Linux
« on: October 22, 2008, 02:56:20 PM »
   How do I make use of the "auto" feature on the Linkstation Mini, using (Ubuntu) Linux?

Colin137

  • Big Bull
  • *****
  • Posts: 1125
Re: Linkstation Mini + Linux
« Reply #1 on: December 05, 2008, 12:46:03 PM »
   I'm sorry for the lateness of this reply. The Auto feature only works when the NASNavigator is installed and running on a PC. Since the NASNavigator is Windows/Mac-only, I'm not sure if it would work for that purpose on your Ubuntu machine. I know the program's discovery function runs fine in WINE on recent versions of Ubuntu, but I'm not sure it would work for the Auto function. Try it by running the NASNavigator in WINE, switching the Linkstation to auto, then turning off the computer. If all is well, the Linkstation should begin shutting down a short while after the computer shuts off.
Message Edited by Colin137 on 12-05-2008 12:47 PM

Diskdoc

  • Calf
  • *
  • Posts: 4
Re: Linkstation Mini + Linux
« Reply #2 on: December 14, 2008, 12:18:16 PM »
   

Better late than never! :)

 

I'll give WINE a shot but if it works I don't think it will be very convenient. I suspect the auto-function works by the NASNavigator just pinging a certain port through UDP or TCP..or possibly with sending some short bit sequence to a certain port? If the information is made public, it should be trivial for someone to write an applet for Linux that does the same thing. Furthermore, since the Linkstation Mini actually runs Linux one would think interoperability wouldn't be too hard to accomplice.

 

What about the Genlink and Freelink projects? Do they acheive working auto-mode somehow?


Colin137

  • Big Bull
  • *****
  • Posts: 1125
Re: Linkstation Mini + Linux
« Reply #3 on: December 20, 2008, 07:15:54 PM »

I uncovered the relevant info for you, sorry it took me so long. NasNavigator version 2 is required, and unfortunately it will not install easily (if at all) in WINE: the part of NasNavi that controls the Auto Shutdown feature is a Windows Service, and apparently, as of version 1.0.1, WINE does not have support for running a Windows Service.

 

The service that installs with NasNavigator version 2 (2.11 on website) is called "NAS PM Service" (PM for Power Management). It sends out a set of three Wake On LAN (WOL) Magic Packets every 5-30 seconds (average about 20 seconds) to the Linkstation. Those packets keep the Linkstation from shutting off when the power switch is set to "Auto". Shutting down the computer (or stopping the NAS PM Service) stops these packets from being sent, and after some time (about 380 seconds), the Linkstation will shut down. Sending a WOL packet to the Linkstation again wakes it up. The Linkstation will disregard WOL packets entirely if power is set to On, Off, or Manual.

 

Diskdoc, you should be able to set up some script to send out a similar set of WOL packets to the Linkstation, but I'm not sure how you would implement that. In your shoes, I'd probably try using Python.    :)

 

This information is only relevant to Buffalo NAS's equipped with an Auto/Manual or Auto/On/Off power function switch.

Message Edited by Colin137 on 12-20-2008 07:27 PM

Diskdoc

  • Calf
  • *
  • Posts: 4
Re: Linkstation Mini + Linux
« Reply #4 on: December 23, 2008, 05:15:20 PM »
   

Great work, Colin! :) Exactly what was needed. I've posted about implementing this in Linux here:

 

Ubuntu Forums

 

I'm actually quite keen to try to do this myself..it seems easy enough to put in some kind of scripted loop. The nicest thing would be to make it into a GTK+ applet to go in the Ubuntu panel but that might take a long time to learn for me :)


Diskdoc

  • Calf
  • *
  • Posts: 4
Re: Linkstation Mini + Linux
« Reply #5 on: January 15, 2009, 12:13:08 PM »
   

I haven't put in much time on fixing this yet but I put together a (ugly, probably) script which seems to keep the Linkstation Mini awake. Maybe it will help someone going down the same path.

 

 #!/bin/bash
while [  6 -lt 9 ]; do
        wakeonlan -i 192.168.1.255 aa:bb:cc:dd:ee:ff

        sleep 20
done


oscar

  • Calf
  • *
  • Posts: 7
Re: Linkstation Mini + Linux
« Reply #6 on: September 29, 2009, 10:23:05 AM »
   

I made this 2 script on my Ubuntu.

 

The first one (Startup_Nas.sh) is to start up the NAS, the second one is to keep it running while the user have the share connected. When the user dismount the share, the script does not send WOL anymore, and after a while, the NAS shutdown.

 

I'd like to link the first script to the Place-bookmark link, but I don't find a way for it....

 

So, the user must call the first script, wait the NAS is up&running, before trying to access the share.

 

The second script can be started at user logon, and must be executed with users's permissions and settings: nobody else can access the $HOME/.gvfs to see if the share is alive.

 

In test, I started it as 

nohup su - user_name -c /usr/local/sbin/KeepUp_NAS.sh  > /dev/null &

 

one for every user_name.

 

Any suggestion is appreciated! :)

 

Oscar

 

 

Startup_Nas.sh
#!/bin/bash

  for (( i=0; i<3; i++ )) ;
   do
      /usr/bin/wakeonlan -i ip_address  mac_address
   done

exit

 

----------

KeepUp_NAS.sh
#!/bin/bash

while (/bin/true) ;
 do
   if [[ -d "/home/$LOGNAME/.gvfs/NAME_OF_SHARE" ]] ; then

     for (( i=0; i<3; i++ )) ;
       do
         /usr/bin/wakeonlan -i ip_address  mac_address
       done

   else
       echo "Nothing to do!";
   fi

  sleep 30

 

done
exit

 


Stefan1981

  • Calf
  • *
  • Posts: 1
Re: Linkstation Mini + Linux
« Reply #7 on: January 12, 2010, 01:14:40 PM »
   

Hi - is there also any way to shutdown the link station immediatly on pc shutdown ? Shutting down the nas navigator software while running the linkstation in automatic mode this works quite fine. No timeout seems to be attended. I found out that there are three modified wake on lane pakets sent to the linkstation on shutdown of nas navigator software  - the six sync bytes (0xff) of the WOL paket were set to zero. I gave it a try but it does not work. Any ideas ?


Colin137

  • Big Bull
  • *****
  • Posts: 1125
Re: Linkstation Mini + Linux
« Reply #8 on: January 12, 2010, 02:45:47 PM »

The WOL packets act as a signal for the NAS to stay awake. Once it hasn't received a WOL packet for 1-5 minutes, it will shut down. There is currently no way to shorten this timeout.