1. 程式人生 > >定時刪除指令碼

定時刪除指令碼

定時刪除7天前打包的war

  

#!/bin/bash
workdir="/var/lib/jenkins/"
do_delete()
{
echo file name is $workdir
find $workdir -name ‘*.war’ -and -mtime +7 -type f -delete
if [ $? -eq 0 ];then
echo $date delete $dir success!
else
echo $date delete $dir FAILD!
fi
}
do_delete

  find /var/lib/jenkins -name '*.war' -and -mtime +7 -type f -delete