16 |
use Algorithm::Diff; |
use Algorithm::Diff; |
17 |
use Getopt::Std; |
use Getopt::Std; |
18 |
use File::Slurp; |
use File::Slurp; |
19 |
|
use File::Pid; |
20 |
|
|
21 |
|
my $pid_path = abs_path($0); |
22 |
|
$pid_path =~ s/\W+/_/g; |
23 |
|
|
24 |
|
my $pidfile = new File::Pid({ |
25 |
|
file => "/tmp/$pid_path", |
26 |
|
}); |
27 |
|
|
28 |
|
if (my $pid = $pidfile->running ) { |
29 |
|
die "$0 already running: $pid\n"; |
30 |
|
} elsif ($pidfile->pid ne $$) { |
31 |
|
$pidfile->remove; |
32 |
|
$pidfile = new File::Pid; |
33 |
|
} |
34 |
|
|
35 |
|
print STDERR "$0 using pid ",$pidfile->pid," file ",$pidfile->file,"\n"; |
36 |
|
$pidfile->write; |
37 |
|
|
38 |
my $bpc = BackupPC::Lib->new || die "can't create BackupPC::Lib"; |
my $bpc = BackupPC::Lib->new || die "can't create BackupPC::Lib"; |
39 |
my %Conf = $bpc->Conf(); |
my %Conf = $bpc->Conf(); |