Subversion Repositories DevTools

Rev

Rev 6754 | Rev 6762 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6754 Rev 6758
Line 41... Line 41...
41
my $RM_DB;
41
my $RM_DB;
42
my $tempdir;
42
my $tempdir;
43
my $sudoUtilsDir = '/home/releasem/sbin';
43
my $sudoUtilsDir = '/home/releasem/sbin';
44
my $lockFile = '/tmp/JATSRN_LOCK';
44
my $lockFile = '/tmp/JATSRN_LOCK';
45
my $scriptDir = "$FindBin::Bin";
45
my $scriptDir = "$FindBin::Bin";
46
my $maxRunTime = 3 * 60;                    # Seconds
46
my $maxRunTime = 5 * 60;                        # Seconds. Time to first warning
-
 
47
my $maxRunTime1 = 5 * 60;                       # Seconds. Time to following warnings
47
 
48
 
48
#
49
#
49
#   Options
50
#   Options
50
#
51
#
51
my $opt_verbose = 0;
52
my $opt_verbose = 0;
Line 104... Line 105...
104
#   PerlMonks say to use $0 as the lock file, but that did not work.
105
#   PerlMonks say to use $0 as the lock file, but that did not work.
105
#       Perhaps the file was open in an editor
106
#       Perhaps the file was open in an editor
106
#       Solution: Create my own file
107
#       Solution: Create my own file
107
#   Generate an error if the script has been running for too long    
108
#   Generate an error if the script has been running for too long    
108
#
109
#
109
open( FW, '>',$lockFile);
110
makeFile($lockFile);
110
print FW '';
111
makeFile($lockFile1) unless -f $lockFile1;
111
close FW;
-
 
112
 
112
 
113
open (my $self, '<', $lockFile) || Error("Couldn't open self: $!");
113
open (my $self, '<', $lockFile) || Error("Couldn't open self: $!");
114
unless ( flock ($self, (LOCK_EX | LOCK_NB)) ){
114
unless ( flock ($self, (LOCK_EX | LOCK_NB)) ){
-
 
115
 
115
    my $runTime = time() - (stat($lockFile))[8];
116
    my $runTime = getFileTime($lockFile);
-
 
117
    my $runTime1 = getFileTime($lockFile1);
-
 
118
 
116
    if ( $runTime > $maxRunTime) {
119
    if ( $runTime > $maxRunTime && $runTime1 >= $maxRunTime1) {
-
 
120
        unlink $lockFile1;
-
 
121
        makeFile($lockFile1);
117
        Error("Script has been running for too long.: $runTime(s)");
122
        Error("Script has been running for too long.: $runTime(s)");
118
    }
123
    }
119
    exit(1);
124
    exit(1);
120
}
125
}
121
 
126
 
Line 157... Line 162...
157
{
162
{
158
    GenerateReleaseNote( $entry);
163
    GenerateReleaseNote( $entry);
159
}
164
}
160
 
165
 
161
unlink $lockFile;
166
unlink $lockFile;
-
 
167
unlink $lockFile1;
162
exit 0;
168
exit 0;
163
 
169
 
164
#-------------------------------------------------------------------------------
170
#-------------------------------------------------------------------------------
165
# Function        : LocatePackages 
171
# Function        : LocatePackages 
166
#
172
#