source: trunk/src/tlogd.sh @ 2

Last change on this file since 2 was 2, checked in by pinsard, 15 years ago

first commit with original work of Francoise Pinsard

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