#!/bin/sh ##++ ======================================================================================= ## System : WordPress cache cleaner ## Emp-division : ## Transaction : ## Calling-sequence : cache-cleaner.sh ## Option : null ## Parameters : ## Return : ## : ## Structure : ## Abstract : ## Modify : 2015/01/30 Ver0.1 新規作成 ## : 01/30 Ver0.2 Log機能追加 閾値を20000から10000に変更 ## : ついでに変数化 ##-- ====================================================================================== #set -x #++ ++++++++++++++++++++++++++++++++++++++++++ # 環境変数 #-- ------------------------------------------ dtm=`date +%Y-%m-%d-%H_%M_%S` CWC=10000 cachewc=`ls /www/blog/wp/com/wp-content/cache12345/head-cleaner/js/ | wc -l` if [[ ${cachewc} -gt ${CWC} ]] then echo "############################" >> /scriptA/logs/cache-delet.log echo " -- `date +%Y-%m-%d-%H_%M_%S` Cache ${cachewc} Deleted Start -- " >> /scriptA/logs/cache-delet.log rm -rf /www/blog/wp/com/wp-content/cache12345/head-cleaner/js/*.js echo " -- `date +%Y-%m-%d-%H_%M_%S` Cache ${cachewc} Deletet Done -- " >> /scriptA/logs/cache-delet.log echo "############################" >> /scriptA/logs/cache-delet.log else echo " -- ${dtm} cache ${cachewc} Not Deleted -- " >> /scriptA/logs/cache-delet.log fi