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
Line 
1#! /bin/sh
2#+
3#
4# .. _tlogd.sh:
5#
6# ========
7# tlogd.sh
8# ========
9#
10# ------------------------------------------------------------------------------------
11# shows the most recent release of :file:`${IRCAAM_LOG}/{action}.log.YYYYMMDDTHHMMSSZ`
12# ------------------------------------------------------------------------------------
13#
14# SYNOPSIS
15# ========
16#
17# ::
18#
19#  $ tlogd.sh action
20#
21#
22# DESCRIPTION
23# ===========
24#
25# ``tlogd.sh`` shows the most recent release of :file:`${IRCAAM_LOG}/{action}.log.{YYYYMMDDTHHMMSSZ}`.
26#
27#
28# SEE ALSO
29# ========
30#
31# :ref:`ircaam_profile.sh`
32#
33# :ref:`dlogd.sh`
34#
35# :ref:`elogd.sh`
36#
37# :ref:`plogd.sh`
38#
39# EVOLUTIONS
40# ==========
41#
42# $Id$
43#
44# - fplod 20100226T151441Z aedon.locean-ipsl.upmc.fr (Darwin)
45#
46#   * replace ????-??-??T??:??:??Z by ????????T??????Z
47#
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
65   AIX|IRIX64)
66      echo " www : no specific posix checking"
67   ;;
68   *)
69      set -o posix
70   ;;
71esac
72unset system
73#
74LANG=POSIX
75#
76command=$(basename ${0})
77#
78if [ "${1}" = "" ]
79then
80   echo "${command} : eee : 1st parameter missing" >&2
81   exit 1
82fi
83# check for ${IRCAAM_LOG} definition
84if [ "${IRCAAM_LOG}" = "" ]
85then
86   echo " eee : \${IRCAAM_LOG} not defined"
87   exit 1
88fi
89#
90# check for ${IRCAAM_LOG} existence
91if [ ! -d ${IRCAAM_LOG} ]
92then
93   echo " eee : ${IRCAAM_LOG} not found"
94   exit 1
95fi
96#
97# check for permission access on IRCAAM_LOG
98if [ ! -x ${IRCAAM_LOG} ]
99then
100   echo " eee : ${IRCAAM_LOG} not reachable"
101   exit 1
102fi
103#
104log=$(find ${IRCAAM_LOG} -name "${1}.log.????????T??????Z" 2> /dev/null | sort | \
105tail -n 1)
106tmp=${?}
107if [ ${tmp} -eq 0 ]
108then
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
117else
118   exit 1
119fi
Note: See TracBrowser for help on using the repository browser.