version 1.8, 2004/12/20 19:53:36
|
version 1.9, 2004/12/22 14:58:15
|
Line 34
|
Line 34
|
# 2 Activity log does not exist |
# 2 Activity log does not exist |
# 3 Unable to connect to database |
# 3 Unable to connect to database |
# 4 Unable to create database tables |
# 4 Unable to create database tables |
# 5 Unspecified error? |
# 5 Unable to open log file |
|
# 6 Unable to get lock on activity log |
# |
# |
|
|
# |
# |
Line 50
|
Line 51
|
|
|
use strict; |
use strict; |
use DBI; |
use DBI; |
|
use lib '/home/httpd/lib/perl/Apache'; |
use lib '/home/httpd/lib/perl/'; |
use lib '/home/httpd/lib/perl/'; |
use LONCAPA::Configuration(); |
use LONCAPA::Configuration(); |
use Apache::lonmysql(); |
use Apache::lonmysql(); |
Line 120 if ($log) {
|
Line 122 if ($log) {
|
my $logfile = $perlvar{'lonDaemons'}.'/tmp/parse_activity_log.log.'.time; |
my $logfile = $perlvar{'lonDaemons'}.'/tmp/parse_activity_log.log.'.time; |
print STDERR "$0: logging to $logfile".$/; |
print STDERR "$0: logging to $logfile".$/; |
if (! open(LOGFILE,">$logfile")) { |
if (! open(LOGFILE,">$logfile")) { |
die "Unable to open $logfile for writing. Run aborted."; |
warn("Unable to open $logfile for writing. Run aborted."); |
|
exit 5; |
} else { |
} else { |
$logthis = \&log_to_file; |
$logthis = \&log_to_file; |
} |
} |
Line 151 $logthis->('Beginning logging '.time);
|
Line 154 $logthis->('Beginning logging '.time);
|
# Wait for a lock on the lockfile to avoid collisions |
# Wait for a lock on the lockfile to avoid collisions |
my $lockfilename = $sourcefilename.'.lock'; |
my $lockfilename = $sourcefilename.'.lock'; |
open(LOCKFILE,'>'.$lockfilename); |
open(LOCKFILE,'>'.$lockfilename); |
flock(LOCKFILE,LOCK_EX) || die("Unable to lock $lockfilename. Aborting".$/); |
if (!flock(LOCKFILE,LOCK_EX)) { |
|
warn("Unable to lock $lockfilename. Aborting".$/); |
|
exit 6; |
|
} |
|
|
## |
## |
## 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 |