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