source: trunk/src/plogd.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: 1.8 KB
Line 
1#! /bin/sh
2#+
3#
4# .. _plogd.sh:
5#
6# ========
7# plogd.sh
8# ========
9#
10# ---------------------------------------------------------------------------------------
11# prints the most recent release of :file:`${IRCAAM_LOG}/{action}.log.{YYYYMMDDTHHMMSSZ}`
12# ---------------------------------------------------------------------------------------
13#
14# SYNOPSIS
15# ========
16#
17# ::
18#
19#  $ plogd.sh action
20#
21#
22# DESCRIPTION
23# ===========
24#
25# ``plogd.sh`` prints the most recent release of :file:`${IRCAAM_LOG}/{action}.log.{YYYYMMDDTHHMMSSZ}`.
26#
27# It uses a2ps application.
28#
29# Print is done on the default printer.
30#
31# SEE ALSO
32# ========
33#
34# :ref:`ircaam_profile.sh`
35#
36# :ref:`dlogd.sh`
37#
38# :ref:`elogd.sh`
39#
40# :ref:`tlogd.sh`
41#
42# EVOLUTIONS
43# ==========
44#
45# $Id$
46#
47# - fplod 20100226T151441Z aedon.locean-ipsl.upmc.fr (Darwin)
48#
49#   * replace ????-??-??T??:??:??Z by ????????T??????Z
50#
51# - fplod 2006-02-20T16:15:35Z aedon.lodyc.jussieu.fr (Darwin)
52#
53#   * posix
54#
55#-
56#
57set -u
58system=$(uname)
59case "${system}" in
60   AIX|IRIX64)
61      echo " www : no specific posix checking"
62   ;;
63   *)
64      set -o posix
65   ;;
66esac
67unset system
68#
69LANG=POSIX
70#
71command=$(basename ${0})
72#
73if [ "${1}" = "" ]
74then
75   echo "${command} : eee : 1st parameter missing" >&2
76   exit 1
77fi
78# test if a2ps available
79tool=a2ps
80type ${tool} 1> /dev/null 2>&1
81status=${?}
82if [ ${status} -ne 0 ]
83then
84   echo "${command} : eee : ${tool} unavailable" >&2
85   exit 4
86fi
87unset tool
88unset status
89#
90systeme=`uname`
91#
92log=$(find ${IRCAAM_LOG} -name "${1}.log.????????T??????Z" | sort | \
93tail -n 1)
94tmp=${?}
95if [ ${tmp} -eq 0 ]
96then
97   if [ "${log}" = "" ]
98   then
99      echo "${command} : eee : no release of ${IRCAAM_LOG}/${1}.log" >&2
100      exit 1
101   else
102      # printing
103      a2ps --print-anyway=1 ${log}
104      exit 0
105   fi
106else
107   exit 1
108fi
Note: See TracBrowser for help on using the repository browser.