Datastore & backup - request for help

Tomeu Vizoso tomeu at tomeuvizoso.net
Tue May 20 04:16:46 EDT 2008


On Tue, May 20, 2008 at 9:47 AM, Martin Langhoff
<martin.langhoff at gmail.com> wrote:
> On Tue, May 20, 2008 at 5:43 PM, Martin Langhoff
> <martin.langhoff at gmail.com> wrote:
>> Now that I have ds_backup that does backup something (thanks Tomeu for
>> the script to grow the ds), I am looking at doing it correctly.
>
> Couple more things that I want to do, and I am unsure where to hook into:
>
>  - On success, this script has to save a "last successful run"
> timestamp locally. Somewhere very cheap to read. If we have a "flags"
> directory, I will gladly touch a file - that is how cheap and simple I
> mean :-) Do we have a "flags" directory that we preserve across
> reboots?

What about ~/.sugar/default?

>  - Similarly, do we have a "locks" directory? I need to flock a file
> to prevent concurrent runs... It is ok if the locks dir gets wiped at
> boot time. /var/lock exists, but the lock group does not include our
> "olpc" user.

~/.sugar/default or a subdirectory might work, as well.

>  - Can we trigger scripts on network changes easily? I want to hook up
> on the same hook that switches gabble on :-) (hmmm, I found
> /etc/NetworkManager/dispatcher.d , looks promising)

Not sure about gabble, but I would expect it to listen for some dbus
signal. If you are curious about which signals/methods happen at some
point, try snooping with dbus-monitor.

>  - Can we check cheaply from shell whether we are on battery power,
> and what the level of the battery is? Is it safe to just read
> /sys/class/power_supply/olpc-battery/capacity and
> /sys/class/power_supply/olpc-ac/status?

What about using HAL? Sugar uses it like this:

http://dev.laptop.org/git?p=sugar;a=blob;f=src/model/devices/battery.py;h=853d00ec490a0b58ef7f569ac1c9a9ef75228259;hb=HEAD

Hope you are not fed up of D-Bus at this point ;)

Good luck,

Tomeu



More information about the Devel mailing list