Blame | Last modification | View Log | RSS feed
#!/bin/shCONFIG=/etc/zarafa/server.cfgtest -f ${CONFIG} || exit 0LOGPATH=$(grep -w client_update_log_path ${CONFIG} | grep -v \# | cut -d= -f2 | sed -e 's/[[:blank:]\r]//g')if test -z "${LOGPATH}"; thenLOGPATH=/var/lib/zarafa/clientfiif ! test -r "${LOGPATH}"; thenexit 0fiLOGPATH=$(readlink -e ${LOGPATH})if test -z "${LOGPATH}"; thenexit 0fiPATHDEPTH=$(echo -en ${LOGPATH} | sed -e 's_[^/]__g' | wc -c)if test -n ${LOGPATH} -a ${PATHDEPTH} -gt 2 -a -d ${LOGPATH}; then# remove all files older than 14 daysfind ${LOGPATH} -mindepth 2 -maxdepth 2 -type f -ctime +14 -exec rm {} \;# remove all empty directoriesfind ${LOGPATH} -mindepth 1 -maxdepth 1 -type d -exec rmdir --ignore-fail-on-non-empty {} \;fi