Ignore:
Timestamp:
2006-12-01T13:16:56+13:00 (17 years ago)
Author:
mdewsnip
Message:

(Remote building) Now creates lock files that are compatible with the GLI.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/cgi-bin/gliserver.pl

    r13385 r13395  
    189189    if (-e $lock_file_name) {
    190190    # A lock file already exists... check if it's ours
     191    my $lock_file_content = "";
    191192    open(LOCK_FILE, "<$lock_file_name");
    192     my $lock_file_owner = <LOCK_FILE>;
     193    while (<LOCK_FILE>) {
     194        $lock_file_content .= $_;
     195    }
    193196    close(LOCK_FILE);
     197
     198    # Pick out the owner of the lock file
     199    $lock_file_content =~ /\<User\>(.*?)\<\/User\>/;
     200    my $lock_file_owner = $1;
    194201
    195202    # The lock file is ours, so there is no problem
     
    204211    }
    205212
    206     # Create a lock file for us and we're done
     213    my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);
     214    my $current_time = sprintf("%02d/%02d/%d %02d:%02d:%02d", $mday, $mon + 1, $year + 1900, $hour, $min, $sec);
     215
     216    # Create a lock file for us (in the same format as the GLI) and we're done
    207217    open(LOCK_FILE, ">$lock_file_name");
    208     print LOCK_FILE "$username";
     218    print LOCK_FILE "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
     219    print LOCK_FILE "<LockFile>\n";
     220    print LOCK_FILE "    <User>" . $username . "</User>\n";
     221    print LOCK_FILE "    <Machine>(Remote)</Machine>\n";
     222    print LOCK_FILE "    <Date>" . $current_time . "</Date>\n";
     223    print LOCK_FILE "</LockFile>\n";
    209224    close(LOCK_FILE);
    210225}
Note: See TracChangeset for help on using the changeset viewer.