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