File: logrun

package info (click to toggle)
metview 5.10.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 242,296 kB
  • sloc: cpp: 437,117; ansic: 41,433; xml: 19,944; f90: 13,059; sh: 6,562; python: 3,953; yacc: 1,774; lex: 1,121; perl: 701; makefile: 92
file content (45 lines) | stat: -rw-r--r-- 1,541 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash

# **************************** LICENSE START ***********************************
#
# Copyright 2012 ECMWF and INPE. This software is distributed under the terms
# of the Apache License version 2.0. In applying this license, ECMWF does not
# waive the privileges and immunities granted to it by virtue of its status as
# an Intergovernmental Organization or submit itself to any jurisdiction.
#
# ***************************** LICENSE END ************************************

#                                                (vk May-98, rev 980507)
#
# This script is a simplified "log-only" version of ECMWF script 'mvrun',
# to be used (through 'metview_local.???') if log files are needed.
#
# Log files are created on $SCRATCH ($SCRATCH needs to be defined!!!).
#

set +e
Module=`basename $1`
start_date=`date`
MYLOG="$SCRATCH/$METVIEW_LOG.$Module.log"

if [ $METVIEW_LOG = no_log -o "$METVIEW_LOG" = "-" ]
then
  # -- no log file --
  "$@"
  SUCCESS_STATUS=$?
else
  # -- create log file --
  echo "[logrun info] process $$ starting `date` with cmd:" > $MYLOG
  echo "[logrun info] $@"                        >> $MYLOG
  echo "[logrun info] mode is $METVIEW_MODE"     >> $MYLOG
  echo ""                                        >> $MYLOG
  
  "$@"                                           >> $MYLOG
  SUCCESS_STATUS=$?

  echo ""                                        >> $MYLOG
  echo "[logrun info] process $$ ended `date`" >> $MYLOG
  echo "[logrun info] exit status: $SUCCESS_STATUS" >> $MYLOG
fi

exit $SUCCESS_STATUS