source: trunk/src/tlogd.sh @ 85

Last change on this file since 85 was 85, checked in by pinsard, 14 years ago

better representation of variable parts in filenames

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