Timed Shutdown

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

Editor's Note

The following information only applies to the older Debian conversion method, NOT FreeLink. The only steps necessary to activate the sleep timer on FreeLink systems are to edit the /etc/melco/timer_sleep and /etc/melco/timer_status files.

Timed Wakeup (Currently NOT working, LS does not wake!)

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:

/etc/melco/timer_sleep

/etc/melco/timer_status

/etc/init.d/ppc_uartd

/sbin/ppc_uartd

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!

Now reboot.

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.

IF NOT:

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

Originally by Thorongil and edited by frontalot from linkstationwiki.org