new_logarchive.sh
2014-04-03 16:08
162 查看
#!/bin/bash #mwg@2012-4-4 banben=jx2 qufu=101-4 gsnum=(1 2 3 4) ################### if [ ${banben} = jx2 -o ${banben} = jx2ib ] then GSDIR=/home/xmission/jxonline2/gs WORKDIR=/home/xmission/jxonline2/jx2tools/logarchive/ elif [ ${banben} = jx2wz ] then GSDIR=/home/kingsoft/server/gameserver0 WORKDIR=/home/kingsoft/server/jx2tools/logarchive/ else echo "banben is error" exit fi TAR_MONTH=`date -d "1 days ago" +%Y_%m` PDIR5=/${banben}/$TAR_MONTH/Real-time_upload/new_Gameserver_${qufu}/ ################### LOCALLOGSAVEDIR=$WORKDIR'new_log-tar-save' #FTP set FTPU='xxxx' FTPP='xxxx' FTPH='0.0.0.0' NCFTPPUT=$WORKDIR'ncftpput' [ ! -d $LOCALLOGSAVEDIR/ ] && mkdir -p $LOCALLOGSAVEDIR/ for j in ${gsnum[@]} do cd /home/xmission/jxonline2/jx2tools/logarchive/ [ -d ./tmp/ ] || mkdir ./tmp/ #判断是否为首次执行 #不是首次执行 if [ -f tmp/old_logfile$j ] && old_logfile=$(cat ./tmp/old_logfile$j) && [ -n $old_logfile ] && old_basefile=$(basename ${old_logfile}) then line_num=$(ls -lt --time-style '+%Y-%m-%d %H:%M:%S' $GSDIR$j/logs/GameServer/*/* |cat -n|awk '{print $1,$9}'|grep "$old_basefile"|awk '{print $1}') #判判断上次上传的文件是否在第二行 #是的话跳过 if [ $line_num -eq 2 ] then : else #如果上次上传的文件所在位置大于2,则上传第2个文件到上次已上传文件 files=($(ls -lt --time-style '+%Y-%m-%d %H:%M:%S' $GSDIR$j/logs/GameServer/*/* |awk '{print $8}'|sed -n "2,/$old_basefile/p"|grep -v "$old_basefile")) for i in ${files[@]} do basefile=$(basename ${i}) tar czf $LOCALLOGSAVEDIR/'GS'${j}_${basefile}.tar.gz ${i} $NCFTPPUT -u$FTPU -p$FTPP -m -R -DD $FTPH $PDIR5 $LOCALLOGSAVEDIR/'GS'${j}_${basefile}.tar.gz \ || $NCFTPPUT -u$FTPU -p$FTPP -m -R -DD $FTPH $PDIR5 $LOCALLOGSAVEDIR/'GS'${j}_${basefile}.tar.gz \ || $NCFTPPUT -u$FTPU -p$FTPP -m -R -DD $FTPH $PDIR5 $LOCALLOGSAVEDIR/'GS'${j}_${basefile}.tar.gz done old_logfile=${files[0]} echo $old_logfile > ./tmp/old_logfile$j fi #首次执行此脚本 else file1=$(ls -lt --time-style '+%Y-%m-%d %H:%M:%S' $GSDIR$j/logs/GameServer/*/* |awk '{print $8}'|sed -n '2p') basefile=$(basename ${file1}) tar czf $LOCALLOGSAVEDIR/'GS'${j}_${basefile}.tar.gz ${file1} old_logfile=$file1 echo $old_logfile > ./tmp/old_logfile$j $NCFTPPUT -u$FTPU -p$FTPP -m -R -DD $FTPH $PDIR5 $LOCALLOGSAVEDIR/'GS'${j}_${basefile}.tar.gz \ || $NCFTPPUT -u$FTPU -p$FTPP -m -R -DD $FTPH $PDIR5 $LOCALLOGSAVEDIR/'GS'${j}_${basefile}.tar.gz \ || $NCFTPPUT -u$FTPU -p$FTPP -m -R -DD $FTPH $PDIR5 $LOCALLOGSAVEDIR/'GS'${j}_${basefile}.tar.gz fi done exit 0
相关文章推荐
- Restore archivelog from ASM to filesystem
- standby_archive_dest和log_archive_dest_n区别
- log_archive_dest&log_archive_dest_n&db_recovery_file_dest的区别
- NOARCHIVELOG模式启动数据库
- FAL[server, ARC2]: FAL archival, error 16099 closing archivelog file 'primary'
- Enable/Disable Archive Log Mode 10g/11g
- Android开发过程中在sh,py,mk文件中添加log信息的方法
- 【Vegas原创】ORA-16040 standby destination archive log file is locked解决
- [Oracle Mgmt] Query Archivelog Mode, Change Archivelog Dest, etc.
- backup archivelog delete input 与delete all input 区别
- Data Guard Standby_archive_dest 和 Log_archive_dest_n 的关系
- Oracle10g已经废弃log_archive_start参数
- ORA-16401 archivelog rejected by RFS 解决方法
- 74.The database is running in ARCHIVELOG mode. Examine the initialization parameters and their value
- alter system archive current log…
- LOSS OF SYSTEM FILE IN ARCHIVELOG MODE
- Oracle log_archive_format 参数
- Using BACKUP ARCHIVELOG with DELETE INPUT or DELETE ALL INPUT【每日一译】--20121115
- New NFC log
- FAL[server, ARC3]: FAL archive failed Error 16401 creating standby archive log file at host