source: XIOS/tools/FCM/examples/etc/regular-update.eg @ 1348

Last change on this file since 1348 was 81, checked in by ymipsl, 12 years ago

ajout FCM 1.5

File size: 1.2 KB
Line 
1#!/bin/sh
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=`cat $headrevfile`
26headrev=`echo $headrev`
27
28# Revision at which this script is last run
29if [[ -r $lastrevfile ]]; then
30  lastrev=`cat $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.