source: trunk/src/dlogd.sh @ 152

Last change on this file since 152 was 50, checked in by pinsard, 13 years ago

replace TROPFLUX by PROJECT

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