Timed wake/shutdown of your debianized LinkStation
|Call for help!|
|If anyone knows a method of programming the wakeup timer, please, tell us, how!|
Timed shutdown of your LinkStation is easy:
- Be sure that "cron" is running
- log in as root
- crontab -e% calls up an editor for editiong root's crontab entries
- the line 15 1 * * * * /sbin/shutdown -h now will shut down the LinkStation at 01:15 each night
- the next 4 "Stars" set the Day of Week, Day of Month, Month and Year, a "*" makes a field variable
Timed Wakeup (Currently NOT working, LS does not wake!)
NOTE by andre: This article is outdated. Go to AVR watch-dog daemon for Linkstation instead.
As it is possible with the original firmware, there should be a way of programming the wake timer also on Debian. First investigation showed, that ppc_uartd is capable of setting the timer.
So go on, grab a copy of the newest OpenLink firmware image from the downloads section.
Now extract the zip and image.dat (which is also ZIP) with the password in the FAQ. Then extract the contained tarball, from which you grab:
Put all the files in the appropriate directories on your Debian. Put ppc_uartd into /usr/sbin, as we don't have a "/sbin" and it's not good style to have one ;-)
- edit /etc/melco/timer_sleep to e.g. "on<>06:00<>23:00"
- edit /etc/melco/timer_status to "sleep<>ready<>06:00<>23:00"
Now let /etc/init.d/ppc_uartd run on boot time (I did this via Webmin, manually, you have to put a link to it into "/etc/rcX.d"...but I don't like messing around there, if you can simply "click" in WebMin ;-)
Please, make sure that /etc/init.d/ppc_uartd works correctly, run "/etc/init.d/ppc_uartd start" and afterwards pstree and look if ppc_uartd is running before rebooting your machine, if ppc_uartd fails to run, the watchdog timer will kick your box down every 5(?) minutes!
Go as root into /var/log, do a grep "timer" * there and see, if it spits out a line like "Timer set to blabla on xyz because time is now reinitialized" or such a thing.
If it is there, OK.
But now do the test if /dev/ttyS1 is relly connected to the AVR, that was NOT the case in my install, do
- echo -n "VVVV" > /dev/ttyS1
Now your "drive full" LED should be lighted in red.
- rm /dev/ttyS1
- ln /dev/AVR00 /dev/ttyS1
NOW it should do (after repeating the "echo" command, of course). If it DOES light red, turn it off with echo -n "WWWW" > /dev/ttyS1.
NOW ppc_uartd should be able to set the timer correctly, do a reboot again, and see your Power LED "pulsate". Fine, isn't it?
Now the problems:
- the hardware clock runs UTC - the system clock runs your local time - if you SET the timer, ppc_uartd looks , if it has to set the timer TODAY or TOMORROW - so you may have to set the timer with the time difference - beware: if you live e.g. in UTC+2 you must set the timer 2 hours earlier