use Algorithm::Diff;
use Getopt::Std;
use File::Slurp;
+use File::Pid;
+
+my $pid_path = abs_path($0);
+$pid_path =~ s/\W+/_/g;
+
+my $pidfile = new File::Pid({
+ file => "/tmp/$pid_path",
+});
+
+if (my $pid = $pidfile->running ) {
+ die "$0 already running: $pid\n";
+} elsif ($pidfile->pid ne $$) {
+ $pidfile->remove;
+ $pidfile = new File::Pid;
+}
+
+print STDERR "$0 using pid ",$pidfile->pid," file ",$pidfile->file,"\n";
+$pidfile->write;
my $bpc = BackupPC::Lib->new || die "can't create BackupPC::Lib";
my %Conf = $bpc->Conf();