source: trunk/src/tlogd.sh @ 152

Last change on this file since 152 was 50, checked in by pinsard, 13 years ago

replace TROPFLUX by PROJECT

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#! /bin/sh
2#+
3#
4# .. program:: tlogd.sh
5#
6# .. _tlogd.sh:
7#
8# =====================================================================================================
9# tlogd.sh -- shows the most recent release of :file:`${PROJECT_LOG}/{action}.log.{YYYYMMDDTHHMMSSZ}`
10# =====================================================================================================
11#
12# SYNOPSIS
13# ========
14#
15# ::
16#
17#  $ tlogd.sh action
18#
19#
20# DESCRIPTION
21# ===========
22#
23# ``tlogd.sh`` shows the most recent release of :file:`${PROJECT_LOG}/{action}.log.{YYYYMMDDTHHMMSSZ}`
24#
25#
26# SEE ALSO
27# ========
28#
29# :ref:`project_profile.sh`
30#
31# :ref:`dlogd.sh`
32#
33# :ref:`elogd.sh`
34#
35# :ref:`plogd.sh`
36#
37# EVOLUTIONS
38# ==========
39#
40# - fplod 20101213T150004Z aedon.locean-ipsl.upmc.fr (Darwin)
41#
42#   * creation
43#
44#-
45#
46set -u
47system=$(uname)
48case "${system}" in
49   AIX|IRIX64)
50      echo " www : no specific posix checking"
51   ;;
52   *)
53      set -o posix
54   ;;
55esac
56unset system
57#
58LANG=POSIX
59#
60command=$(basename ${0})
61#
62if [ "${1}" = "" ]
63then
64   echo "${command} : eee : 1st parameter missing" >&2
65   exit 1
66fi
67# check for ${PROJECT_LOG} definition
68if [ "${PROJECT_LOG}" = "" ]
69then
70   echo " eee : \${PROJECT_LOG} not defined"
71   exit 1
72fi
73#
74# check for ${PROJECT_LOG} existence
75if [ ! -d ${PROJECT_LOG} ]
76then
77   echo " eee : ${PROJECT_LOG} not found"
78   exit 1
79fi
80#
81# check for permission access on PROJECT_LOG
82if [ ! -x ${PROJECT_LOG} ]
83then
84   echo " eee : ${PROJECT_LOG} not reachable"
85   exit 1
86fi
87#
88log=$(find ${PROJECT_LOG} -name "${1}.log.????????T??????Z" 2> /dev/null | sort | \
89tail -n 1)
90tmp=${?}
91if [ ${tmp} -eq 0 ]
92then
93   if [ "${log}" = "" ]
94   then
95      echo "${command} : eee : no release of ${PROJECT_LOG}/${1}.log" >&2
96      exit 1
97   else
98      more ${log}
99      exit 0
100   fi
101else
102   exit 1
103fi
Note: See TracBrowser for help on using the repository browser.