source: trunk/src/dlogd.sh @ 77

Last change on this file since 77 was 77, checked in by pinsard, 14 years ago

indent shell scripts

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1#! /bin/sh
2#+
3#
4# ========
5# dlogd.sh
6# ========
7#
8# --------------------------------------------------------------------------------------------------
9# prompt for destruction of the most recent release of ${IRCAAM_LOG}/action.log.YYYYMMDDTHHMMSSZ
10# --------------------------------------------------------------------------------------------------
11#
12# SYNOPSIS
13# ========
14#
15# ::
16#
17#  $ dlogd.sh action
18#
19# DESCRIPTION
20# ===========
21#
22# ``dlogd.sh`` prompt for destruction of the most recent release of ${IRCAAM_LOG}/action.log.\ *YYYYMMDDTHHMMSSZ*.
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# EVOLUTIONS
45# ==========
46#
47# $Id$
48#
49# - fplod 20100226T151441Z aedon.locean-ipsl.upmc.fr (Darwin)
50#
51#   * replace ????-??-??T??:??:??Z by ????????T??????Z
52#
53# - fplod 2006-02-20T16:44:33Z aedon.lodyc.jussieu.fr (Darwin)
54#
55#   * posix
56#
57#-
58#
59set -u
60system=$(uname)
61case "${system}" in
62   AIX|IRIX64)
63      echo " www : no specific posix checking"
64   ;;
65   *)
66      set -o posix
67   ;;
68esac
69unset system
70#
71LANG=POSIX
72#
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.