Left overs for 'X' and 'V' series
From NAS-Central Buffalo - The Linkstation Wiki
How does the "auto" mode work?
There is a process running, waiting for WoL packets to arrive.
This process can be found as "pwrmgr" in the process list.
In addition to this, there is a script "/usr/local/sbin/pmcd_exec.sh" which uses a feature of the pwrmgr to keep the box alive even if there is no client anymore (e.g. in case of running backups, RAID recovery, running disk format etc.).
How to keep a box alive without a client in "auto" mode?
Sometimes one wants to keep the box alive until a script running on the box finished a long time task.
If the box is running in "auto" mode (means: staying alive until the last client stops sending WoL packets), one just has to call the next line once every 3 minutes to keep the box alive:
pwrmgr -c localhost act
But how to use this, if the long time task takes more than 3 minutes to finish?
Before starting the long time task, create a file in /var/lock/ you can test for existance:
Then start this script as a background task (means: add a " &" when calling the script):
#!/bin/sh while [ -f /var/lock/kenatonline ]; do /usr/local/sbin/pwrmgr -c localhost act sleep 180 done
After the long time task, delete the file:
The box will shutdown automatically within 3 minutes.
Of course this will only work, if the long time task is synchronous itself (means: the long time task is blocking the user input until it has finished).
Is it asynchronous, you have to find the postcondition which is true when the task finished and replace the while condition of the script above (e.g. testing for the process of the long time task).
How to wake up and keep a box alive without using Buffalos applications?
Not everyone likes to use the utilities Buffalo provided (if they are available for the intended target operating system at all).
Network is a private class B network (10.131.0.0 - 10.131.255.255), netmask is 255.255.0.0 (obviously).
MAC address of the box is "ABCDEF123456" (or "AB:CD:EF:12:34:56" if you are used to the Windows format).
The LS has the IP address of 10.131.200.1 (this IP address is not necessary in the code!).
#!/usr/bin/env python import socket import time s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) while 1: s.sendto('\xff'*6+'\xAB\xCD\xEF\x12\x34\x56'*16, ('10.131.255.255', 9)) print "Sent paket!" time.sleep(180)
If your netmask is 255.255.255.0, you have to replace "10.131.255" with the first three numbers of your network segment.
You can put the code example just into a file and start the python interpreter by hand providing the file as parameter or execute the file as a shell script (on UNIXoid systems like LINUX, Mac OS X, FreeBSD etc.).
On an Enigma2 Dreambox or Mac OS X you will have a python interpreter within the default installation of the system. Other systems may need an installation of the python package beforehand.