#! /bin/sh #+ # # .. program:: dlogd.sh # # .. _dlogd.sh: # # ======================================================================================================================== # dlogd.sh -- prompt for destruction of the most recent release of :file:`${TROPFLUX_LOG}/{action}.log.{YYYYMMDDTHHMMSSZ}` # ======================================================================================================================== # # SYNOPSIS # ======== # # :: # # $ dlogd.sh action # # # DESCRIPTION # =========== # # ``dlogd.sh`` prompt for destruction of the most recent release of :file:`${TROPFLUX_LOG}/{action}.log.{YYYYMMDDTHHMMSSZ}`. # # SEE ALSO # ======== # # :ref:`tropflux_profile.sh` # # :ref:`elogd.sh` # # :ref:`plogd.sh` # # :ref:`tlogd.sh` # # EVOLUTIONS # ========== # # - fplod 20101213T145910Z aedon.locean-ipsl.upmc.fr (Darwin) # # * creation # #- # set -u system=$(uname) case "${system}" in AIX|IRIX64) echo " www : no specific posix checking" ;; *) set -o posix ;; esac unset system # LANG=POSIX # command=$(basename ${0}) # if [ "${1}" = "" ] then echo "${command} : eee : 1st parameter missing" >&2 exit 1 fi # # check for ${TROPFLUX_LOG} definition if [ "${TROPFLUX_LOG}" = "" ] then echo " eee : \${TROPFLUX_LOG} not defined" exit 1 fi # # check for ${TROPFLUX_LOG} existence if [ ! -d ${TROPFLUX_LOG} ] then echo " eee : ${TROPFLUX_LOG} not found" exit 1 fi # # check for permission access on TROPFLUX_LOG if [ ! -x ${TROPFLUX_LOG} ] then echo " eee : ${TROPFLUX_LOG} not reachable" exit 1 fi # check for write permission on TROPFLUX_LOG if [ ! -w ${TROPFLUX_LOG} ] then echo " eee : ${TROPFLUX_LOG} not writable" exit 1 fi # log=$(find ${TROPFLUX_LOG} -name "${1}.log.????????T??????Z" | sort | \ tail -n 1) tmp=${?} if [ ${tmp} -eq 0 ] then if [ "${log}" = "" ] then echo "${command} : eee : no release of ${TROPFLUX_LOG}/${1}.log" >&2 exit 1 else # destruction du fichier ${log} /bin/rm -i ${log} unset log exit 0 fi else exit 1 fi