From: Chris R. <cro...@gc...> - 2009-07-13 23:05:33
|
Matthias Meyer wrote: > 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 > The kill signal (-9) should only be used as a last resort. http://sial.org/howto/shell/kill-9/ (That link is down at the moment, so I'll link to the archive as well: http://web.archive.org/web/20080208221340/http://sial.org/howto/shell/kill-9/bonk.jpg) > done > done < /tmp/runnings > exit 0 > > br > Matthias > Chris |