#!/bin/bash FTP_IP=127.0.0.1 FTP_USER="aaa" FTP_PSW="bbb" GAME_NAME="ccc" cd /data/ftp_dir tar zcvf action.tar.gz logs/* VAR_FULL_MD5=`md5sum action.tar.gz|cut -d ' ' -f1` VAR_MD5=${VAR_FULL_MD5:12:8} YESTERDAY_STRING=`date '+%Y%m%d' -d '-1day'` TAR_NAME=${GAME_NAME}'_action_'${YESTERDAY_STRING}_${VAR_MD5}.tar.gz echo ${TAR_NAME} mv action.tar.gz ${TAR_NAME} ftp -n ${FTP_IP} << EOF user ${FTP_USER} ${FTP_PSW} binary prompt mput *.gz* close quit EOF mv -f *.gz* ../ftp_dir_old/