source: LMDZ5/branches/testing/tools/fcm/templates/utils/cron_template.ksh @ 5456

Last change on this file since 5456 was 1665, checked in by Laurent Fairhead, 12 years ago

Version testing basée sur la r1628

http://lmdz.lmd.jussieu.fr/utilisateurs/distribution-du-modele/versions-intermediaires


Testing release based on r1628

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#!/usr/bin/ksh
2# ------------------------------------------------------------------------------
3# (C) Crown copyright Met Office. All rights reserved.
4# For further details please refer to the file COPYRIGHT.txt
5# which you should have received as part of this distribution.
6# ------------------------------------------------------------------------------
7
8lockfile='lock'
9
10if [[ -f $lockfile ]]; then
11  exit
12fi
13
14touch $lockfile
15
16headrevfile='latest'
17lastrevfile='lastrev'
18
19# Current HEAD revision
20if [[ ! -r $headrevfile ]]; then
21  echo "HEAD revision file $headrevfile cannot be read, abort" >&2
22  rm -f $lockfile
23  exit 1
24fi
25headrev=$(<$headrevfile)
26headrev=$(echo $headrev)
27
28# Revision at which this script is last run
29if [[ -r $lastrevfile ]]; then
30  lastrev=$(<$lastrevfile)
31  lastrev=$(echo $lastrev)
32else
33  lastrev=0
34fi
35
36# Exit if HEAD revision is the same as the last run revision
37if (($lastrev == $headrev)); then
38  rm -f $lockfile
39  exit 0
40fi
41
42# ------------------------------------------------------------------------------
43# Do something...
44# ------------------------------------------------------------------------------
45
46# Update last run revision file
47echo $headrev >$lastrevfile
48rm -f $lockfile
49
50# EOF
Note: See TracBrowser for help on using the repository browser.