New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
regular-update.eg in vendors/fcm/current/examples/etc – NEMO

source: vendors/fcm/current/examples/etc/regular-update.eg @ 1977

Last change on this file since 1977 was 1977, checked in by flavoni, 14 years ago

importing fcm vendor

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.