a logrotate scripts

logrotate.sh

#!/bin/bash

cd `dirname $0`
d=`date +%Y%m%d`
d7=`date -d’7 day ago’ +%Y%m%d`

cp tu.log tu.log.${d}
echo “” > tu.log
rm -rf tu.log.${d7}

dirname $0 是代表脚本所在目录

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>