怎样使log文件带时间戳,怎样通过时间戳来控制变量
我想用Bourne shell来完成。
现有的log file存在,但是不带时间戳。
LOG_FILE=$LOG_DIR/A.log
我的batch job在一开始会检查log file是否存在
if [ -n "$LOG_FILE" ]
then
:
else
echo "LOG_FILE not defined in configuration file"
exit 99
fi
date "+%F"
date "+%F_%T"
mv a.log a.log.`date "+%F"`