ftp上传日志的脚本
时间:2006-08-10 来源:brave_script
#!/bin/sh
DATE=`date +%F --date="-1 day"`
ADDR=*.*.*.*
USER=XXX
PASSWORD=XXXX
mkdir /tmp/weblog >/dev/null 2>&1
mkdir -p /var/log/backlog >/dev/null 2>&1
BACKDIR=/var/log/backlog
cd /var/log/httpd/
for i in `ls *.log.1 | awk -F "." '{print $1}'`
do
cp /var/log/httpd/$i.log.1 $BACKDIR/$i.log
done
rm -f /tmp/weblog/*
cd /tmp/weblog
tar -czf promote2.log.tar.gz --directory=$BACKDIR promote2.log
tar -czf ec2.log.tar.gz --directory=$BACKDIR ec2.log
tar -czf case2.log.tar.gz --directory=$BACKDIR case2.log
tar -czf communion2.log.tar.gz --directory=$BACKDIR communion2.log
rm -rf $BACKDIR
ftp -v -i -n >/tmp/ftp.log << !
open $ADDR
user $USER $PASSWORD
mkdir $DATE
cd $DATE
lcd /tmp/weblog
mput *
bye
!