Package: dirvish
Version: 1.2.1-1.1
Severity: normal
Tags: patch

I have some machines that take a long time to run their backups.

The dirvish cron job runs every day, but sometimes yesterday's dirvish 
jobs are still running.  The dirvish cron job happily tries to run 
dirvish again; now you get half the network bandwidth available, so if 
that day's backups take that long again, they'll create an infinite 
backlog....

The /etc/dirvish/dirvish-cronjob that starts the backups can address 
this; I have attached a patch that does address it.

I release the patch under the terms of the GNU General Public License 
version 2 or later, at your option.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-3-vserver-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages dirvish depends on:
ii  libtime-modules-perl         2006.0814-2 Various Perl modules for time/date
ii  libtime-period-perl          1.20-8      Perl library for testing if a time
ii  perl                         5.8.8-12    Larry Wall's Practical Extraction 
ii  perl-modules                 5.8.8-12    Core Perl modules
ii  rsync                        3.0.2-1     fast remote file copy program (lik

Versions of packages dirvish recommends:
ii  ssh                           1:4.7p1-8  secure shell client and server (me

-- no debconf information
36a37,62
> ## Asheesh's locking addition
> fail() {
>       echo "Cron job currently running; I'm outta here."
>       exit 1;
> }
> 
> 
> die_if_dirvish_locked() {
>       OTHER_PID=$(cat /var/lock/dirvish-cronjob 2>/dev/null)
>       # if the PID file exists:
>       [ -f  /var/lock/dirvish-cronjob ] && 
>       ps "$OTHER_PID" 2>&1 >/dev/null && fail
> }
> 
> lock_dirvish() {
>       MY_PID=$$
>       echo "$MY_PID" > /var/lock/dirvish-cronjob
> }
> 
> unlock_dirvish() {
>       rm -f /var/lock/dirvish-cronjob
> }
> 
> die_if_dirvish_locked
> lock_dirvish
> 
44a71,72
> unlock_dirvish
> 

Reply via email to