===================================
Waking up a Mac at a certain time
===================================
:Id: SW/pmset-linux-workaround
:CreationDate: 2008-10-02 18:10:00
:tags: software
I have an old G3 iBook that I use to perform backups (using
rsnapshot_). The scripts that run the backup process start it as soon
as the machine wakes up, and put it back to sleep afterwards (using
pbbuttonsd_). Problem: every time I want to run a backup, I have to
manually wake the machine up (by pressing the power button, or opening
the lid). Clearly I'd like for the backup to happen ever if I forget,
or if I'm not at home.
How it works on `Mac OS X`
==========================
If that iBook were running `Mac OS X`, it would be easy::
pmset repeat wake MTWRFSU 05:00:00
and it would wake up automatically, every day at 5 in the morning
(those letters are ugly abbreviations for the English names of the
days of the week).
But I have Linux running on that machine!
Can it be done in Linux?
========================
It seems it can't: ``drivers/macintosh/via-pmu.c``, the Power
Management Unit's driver, implements only a couple of functions.
Is there a hope?
================
I tried to use a trick. I started with the `Mac OS X` 10.4
installation disk, opened a Terminal, and run ``pmset``. Which did not
work, giving me an error 0xe00002bc. Digging a bit on the Web we
discover that such error means more or less "I can't write a
file". *Write a file*? Whoever asked for such a thing?
Reading more attentively the documentation_ for ``pmset``, we discover
that it writes a couple of file in
``/Library/Preferences/SystemConfiguration``. Obviously, having booted
off a CD, that directory is read-only.
I can't find a way to create a ``tmpfs`` or similar, so I take a USB
stick and try to mount it. It does not work: there are no drivers for
`FAT`, or something. OK, I just format it `HFS`, and finally I mount
it::
mount -o union -t hfs /dev/disk5s1 /Library/Preferences/SystemConfiguration
I re-run ``pmset``, and finally the configuration is set.
Sadly it still does not work ``:-(``
.. _rsnapshot: http://www.rsnapshot.org/
.. _pbbuttonsd: http://pbbuttons.berlios.de/
.. _documentation:
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/pmset.1.html