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