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