Add proper locking code.
This commit is contained in:
parent
68d950a036
commit
1a31551d37
1 changed files with 6 additions and 2 deletions
|
@ -541,6 +541,9 @@ sub ReadConfig($) {
|
||||||
}
|
}
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
system("/usr/bin/lockfile -r 8 $CALENDAR_LOCK_FILE");
|
||||||
|
DieLog("Failure to acquire calendar lock on $CALENDAR_LOCK_FILE") unless ($? == 0);
|
||||||
|
|
||||||
my $config = ReadConfig($CONFIG_FILE);
|
my $config = ReadConfig($CONFIG_FILE);
|
||||||
|
|
||||||
$config->{scrubPrivate} = 0 if not defined $config->{scrubPrivate};
|
$config->{scrubPrivate} = 0 if not defined $config->{scrubPrivate};
|
||||||
|
@ -551,7 +554,7 @@ DieLog("$config->{emacsBinary} doesn't appear to be executable") unless -x $conf
|
||||||
|
|
||||||
if (defined $config->{cleanOutputDirFirst} and $config->{cleanOutputDirFirst}) {
|
if (defined $config->{cleanOutputDirFirst} and $config->{cleanOutputDirFirst}) {
|
||||||
chdir $config->{outputDir} or die "unable to change directory to $config->{outputDir} $? $!";
|
chdir $config->{outputDir} or die "unable to change directory to $config->{outputDir} $? $!";
|
||||||
system("/bin/rm", '-f', "*.ics");
|
system("/bin/rm -f *.ics");
|
||||||
}
|
}
|
||||||
|
|
||||||
DieLog("$CONFIG_FILE doesn't specify a (readable) output directory via outputDir setting: $!")
|
DieLog("$CONFIG_FILE doesn't specify a (readable) output directory via outputDir setting: $!")
|
||||||
|
@ -562,10 +565,11 @@ DieLog("$CONFIG_FILE doesn't specify a readable public nor a private diary file"
|
||||||
unless (defined $config->{publicDiary} and -r $config->{publicDiary}) or
|
unless (defined $config->{publicDiary} and -r $config->{publicDiary}) or
|
||||||
(defined $config->{privateyDiary} and -r $config->{privateDiary});
|
(defined $config->{privateyDiary} and -r $config->{privateDiary});
|
||||||
|
|
||||||
|
|
||||||
FilterEmacsToICal($config->{publicDiary}, $config->{privateDiary},
|
FilterEmacsToICal($config->{publicDiary}, $config->{privateDiary},
|
||||||
$config->{outputDir}, $config, $config->{user});
|
$config->{outputDir}, $config, $config->{user});
|
||||||
|
|
||||||
|
&$LOCK_CLEANUP_CODE();
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
# Local variables:
|
# Local variables:
|
||||||
# compile-command: "perl -c calendar-export.plx"
|
# compile-command: "perl -c calendar-export.plx"
|
||||||
|
|
Loading…
Add table
Reference in a new issue