1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # ========================================================================
|
---|
4 | #
|
---|
5 | # *
|
---|
6 | # * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
7 | # * Software. It is distributed to you in the hope that it can be a useful
|
---|
8 | # * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
9 | # * It is distributed WITHOUT ANY WARRANTY.
|
---|
10 | # *
|
---|
11 | # * Permission to use, copy, modify and distribute this software and its
|
---|
12 | # * documentation for any purpose is hereby granted without fee,
|
---|
13 | # * provided that the above copyright notice appear in all copies and
|
---|
14 | # * that both that copyright notice and this permission notice appear
|
---|
15 | # * in supporting documentation. It is provided "as is" without express
|
---|
16 | # * or implied warranty.
|
---|
17 | # *
|
---|
18 | #
|
---|
19 | #
|
---|
20 | # Author(s): Daniela Dorner 08/2005 <mailto:dorner@astro.uni-wuerzburg.de>
|
---|
21 | #
|
---|
22 | # Copyright: MAGIC Software Development, 2000-2006
|
---|
23 | #
|
---|
24 | #
|
---|
25 | # ========================================================================
|
---|
26 | #
|
---|
27 | # This script is removing lock files which are older than 12 hours.
|
---|
28 | #
|
---|
29 | # Each process in the automatic analysis is writing a lock file. As these
|
---|
30 | # processes are launched with condor, they are stopped after 12 hours, if
|
---|
31 | # they are still running. In this case the lock files are not removed.
|
---|
32 | #
|
---|
33 | # By comparing the date of the lock file and the current date, the
|
---|
34 | # running time of a process is determined and if it is bigger than 12
|
---|
35 | # hours (which means that the process has been already kill by condor) the
|
---|
36 | # lock file is removed
|
---|
37 | #
|
---|
38 |
|
---|
39 | source /home/$USER/Mars/datacenter/scripts/sourcefile
|
---|
40 |
|
---|
41 | files=`ls $lockpath/*`
|
---|
42 |
|
---|
43 | for file in ${files[@]}
|
---|
44 | do
|
---|
45 | filedate=`date +%Y%j%H%M -r $file`
|
---|
46 | #date to compare: now - 12hours
|
---|
47 | compdate=`date +%Y%j%H%M --date="-12hour"`
|
---|
48 |
|
---|
49 | if [ $compdate -gt $filedate ]
|
---|
50 | then
|
---|
51 | rm -v $file
|
---|
52 | echo "date: "$filedate
|
---|
53 | echo "comp: "$compdate
|
---|
54 | date
|
---|
55 | fi
|
---|
56 | done
|
---|
57 |
|
---|