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