version 1.6, 2004/12/16 15:03:29
|
version 1.7, 2004/12/16 19:29:20
|
Line 45 use Time::HiRes();
|
Line 45 use Time::HiRes();
|
use Getopt::Long(); |
use Getopt::Long(); |
use IO::File; |
use IO::File; |
use File::Copy; |
use File::Copy; |
|
use Fcntl qw(:flock); |
|
|
# |
# |
# Determine parameters |
# Determine parameters |
my ($help,$course,$domain,$drop,$file,$time_run,$nocleanup,$log,$backup); |
my ($help,$course,$domain,$drop,$file,$time_run,$nocleanup,$log,$backup); |
Line 131 $error_filename = $sourcefilename;
|
Line 133 $error_filename = $sourcefilename;
|
$error_filename =~ s|[^/]*$|activity.log.errors|; |
$error_filename =~ s|[^/]*$|activity.log.errors|; |
$logthis->('Beginning logging '.time); |
$logthis->('Beginning logging '.time); |
|
|
|
|
|
# |
|
# Wait for a lock on the lockfile to avoid collisions |
|
my $lockfilename = $sourcefilename.'.lock'; |
|
open(LOCKFILE,'>'.$lockfilename); |
|
flock(LOCKFILE,LOCK_EX) || die("Unable to lock $lockfilename. Aborting".$/); |
|
|
## |
## |
## There will only be a $newfilename file if a copy of this program is already |
## There will only be a $newfilename file if a copy of this program is already |
## running. |
## running. |
my $newfilename = $sourcefilename.'.processing'; |
my $newfilename = $sourcefilename.'.processing'; |
if (-e $newfilename) { |
if (-e $newfilename) { |
warn "$newfilename exists"; |
warn "$newfilename exists"; |
$logthis->($newfilename.' exists'); |
$logthis->($newfilename.' exists, so I cannot work on it.'); |
exit 2; |
exit 2; |
} |
} |
|
|
Line 153 if (-e $sourcefilename) {
|
Line 162 if (-e $sourcefilename) {
|
$logthis->('touch was completed'); |
$logthis->('touch was completed'); |
} |
} |
|
|
|
close(LOCKFILE); |
|
|
## |
## |
## Table definitions |
## Table definitions |
## |
## |
Line 328 if (-s $newfilename) {
|
Line 339 if (-s $newfilename) {
|
exit 5; |
exit 5; |
} elsif ($result > 0) { |
} elsif ($result > 0) { |
$time_this->(); |
$time_this->(); |
$logthis->('process_courselog returned '.$result.' backup up tables'); |
$logthis->('process_courselog returned '.$result.' backing up tables'); |
&backup_tables($gz_sql_filename); |
&backup_tables($gz_sql_filename); |
$time_this->('write backup tables'); |
$time_this->('write backup tables'); |
} |
} |