Last change
on this file since 97 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 | # |
---|
45 | set -u |
---|
46 | system=$(uname) |
---|
47 | case "${system}" in |
---|
48 | AIX|IRIX64) |
---|
49 | echo " www : no specific posix checking" |
---|
50 | ;; |
---|
51 | *) |
---|
52 | set -o posix |
---|
53 | ;; |
---|
54 | esac |
---|
55 | unset system |
---|
56 | # |
---|
57 | LANG=POSIX |
---|
58 | # |
---|
59 | command=$(basename ${0}) |
---|
60 | # |
---|
61 | if [ "${1}" = "" ] |
---|
62 | then |
---|
63 | echo "${command} : eee : 1st parameter missing" >&2 |
---|
64 | exit 1 |
---|
65 | fi |
---|
66 | # |
---|
67 | # check for ${PROJECT_LOG} definition |
---|
68 | if [ "${PROJECT_LOG}" = "" ] |
---|
69 | then |
---|
70 | echo " eee : \${PROJECT_LOG} not defined" |
---|
71 | exit 1 |
---|
72 | fi |
---|
73 | # |
---|
74 | # check for ${PROJECT_LOG} existence |
---|
75 | if [ ! -d ${PROJECT_LOG} ] |
---|
76 | then |
---|
77 | echo " eee : ${PROJECT_LOG} not found" |
---|
78 | exit 1 |
---|
79 | fi |
---|
80 | # |
---|
81 | # check for permission access on PROJECT_LOG |
---|
82 | if [ ! -x ${PROJECT_LOG} ] |
---|
83 | then |
---|
84 | echo " eee : ${PROJECT_LOG} not reachable" |
---|
85 | exit 1 |
---|
86 | fi |
---|
87 | # check for write permission on PROJECT_LOG |
---|
88 | if [ ! -w ${PROJECT_LOG} ] |
---|
89 | then |
---|
90 | echo " eee : ${PROJECT_LOG} not writable" |
---|
91 | exit 1 |
---|
92 | fi |
---|
93 | # |
---|
94 | log=$(find ${PROJECT_LOG} -name "${1}.log.????????T??????Z" | sort | \ |
---|
95 | tail -n 1) |
---|
96 | tmp=${?} |
---|
97 | if [ ${tmp} -eq 0 ] |
---|
98 | then |
---|
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 |
---|
109 | else |
---|
110 | exit 1 |
---|
111 | fi |
---|
Note: See
TracBrowser
for help on using the repository browser.