BackupPC-users

Re: [BackupPC-users] Automatically stopping running backups during business hours

2009-07-12 12:00:53
Subject: Re: [BackupPC-users] Automatically stopping running backups during business hours
From: Matthias Meyer <matthias.meyer AT gmx DOT li>
To: backuppc-users AT lists.sourceforge DOT net
Date: Sun, 12 Jul 2009 17:56:59 +0200
Adam Goryachev wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Langdon Stevenson wrote:
>> I have a number of servers at remote sites that get backed up over ADSL
>> connections.  Usually the backups run in an hour or two outside of
>> business hours which is fine.
>>
>> However occasionally a user will add a large number of files to a
>> server, causing the backup to take much longer.  This causes a serious
>> slow-down of the ADSL connection for staff at the effected site during
>> the day.
>>
>> What I would like is for BackupPC to automatically stop backups at
>> 7.00am or some other configurable time if they are still running.
>>
>> I have read the documentation and can find no way of doing this, only
>> the ability to stop backups from starting during certain periods.
>>
>> Can anyone confirm that BackupPC is unable to do what I need?  If so,
>> does anyone know of a hack or patch to add this functionality?
> 
> As far as I know there is no solution to this within BackupPC, one
> thing you can do is use the bwlimit parameter to rsync, and setup QoS
> on the ADSL to try and keep things reasonable. However, trying to do
> VoIP can still be a challenge, in which case the only solution is to
> manually login and stop the backup...
> 
> I suppose you could have a script which runs at 9am to firewall the
> relevant ports and hence stop the backup, then at 5pm it unblocks again.
> 
> Regards,
> Adam

As an alternative you can place the following script in /etc/crontab.
#!/bin/bash
declare -a hosts
hosts[0]=server1        # fill in your own host names
hosts[1]=server2        # whose backup should be canceld
hosts[2]=server3
declare -i hostcount=3  # configure your count of killable hosts

ps ax | grep "BackupPC_dump -i" | grep -v grep > /tmp/runnings
while read pid fl1 fl2 duration perl dump fl3 host rest
do
        for (( a=0; a<hostcount; a++ ))
        do
                if [ $host == ${hosts[a]} ]; then kill -9 $pid > /dev/null 
2>&1; fi
        done
done < /tmp/runnings
exit 0

br
Matthias
-- 
Don't Panic


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/