备份linux系统日志脚本
#!/bin/bash
#script_name bkup_log.sh
#7 0 * * 1 cd /home/tools/;./bkup_log.sh >& /dev/null
process_day=`date -d today +"%y%m%d"`
if [ ! -d /var/log/bkup_log ];then
cd /var/log && mkdir bkup_log
#script_name bkup_log.sh
#7 0 * * 1 cd /home/tools/;./bkup_log.sh >& /dev/null
process_day=`date -d today +"%y%m%d"`
if [ ! -d /var/log/bkup_log ];then
cd /var/log && mkdir bkup_log
fi
for i in wtmp maillog messages;
do
{
cp /var/log/$i /var/log/bkup_log/$i-$process_day
}
done
for i in wtmp maillog messages;
do
{
cp /var/log/$i /var/log/bkup_log/$i-$process_day
}
done