[Box Backup] Continuous backup only when idle

Yang Zhang yanghatespam at gmail.com
Thu May 19 02:56:20 BST 2011


On Wed, May 18, 2011 at 1:18 PM, Chris Wilson <chris at qwirx.com> wrote:
> Hi Yang,
>
> On Tue, 17 May 2011, Yang Zhang wrote:
>
>> I think that requires su to run, otherwise I get:
>>
>> ** Message: Failed to connect to the D-BUS daemon: Failed to connect
>> to socket /tmp/dbus-3xuFKEU3cy: Connection refused
>
> Yes, if you run bbackupd as a different user than you log in to X with, then
> you would need to su to the logged-in user before running
> gnome-screensaver-command.
>
>> Instead I'm checking the tty's for idle times, which encompasses ssh
>> sessions but doesn't cover X-only activity:
>>
>> w | perl -ane '
>>  BEGIN { $x = 1 };
>>  next if $. <= 2;
>>  $x &= $F[4] =~ /(m|days)$/;
>>  END { print $x ? "now\n" : "3600\n"; }
>> '
>
> Thanks for the script! Does it solve the problem, i.e. allow backups when
> the system is idle for you?

Yeap, seems to be doing the job for me!  Slightly shorter and incorporating X:

if gnome-screensaver-command -q | fgrep -q 'The screensaver is active' &&
   ! w | tail -n +3 | perl -ane 'print $F[4],"\n"' | egrep -qv '(days|m)$'
then echo now
else echo 3600
fi

>
> Cheers, Chris.
> --
> _____ __     _
> \  __/ / ,__(_)_  | Chris Wilson <chris+sig at qwirx.com> Cambs UK |
> / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Ruby/Perl/SQL Developer |
> \__/_/_/_//_/___/ | We are GNU : free your mind & your software |
> _______________________________________________
> Boxbackup mailing list
> Boxbackup at boxbackup.org
> http://lists.boxbackup.org/cgi-bin/mailman/listinfo/boxbackup
>



-- 
Yang Zhang
http://yz.mit.edu/



More information about the Boxbackup mailing list