ftp.sh

IBM Power 2012. 6. 28. 15:01

#!/usr/bin/ksh
if [ $# -ne 5 ]; then
    echo " Usage: ftp.sh <ftp server ip> <ftp user> <ftp password> <target director> <source file> "
    echo "    ex. ftp.sh 10.10.20.101 root passwd /home/ftp_back /etc/hosts "
    exit 1
fi

source_full_path=${5}
source_file=`echo ${source_full_path} | awk -F"/" '{print$NF}'`
source_path=`echo ${source_full_path} | awk -F'/[^/]*$' '{print $1}'`

new_file_name="${source_file}_`date +\"%Y%m%d%H%M%S\"`"

ftp -n ${1}  <<! >> ftp.log

        user ${2} ${3}
        lcd ${source_path}
        cd ${4}
        as

        put ${source_file} ${new_file_name}
        bye
!



'IBM Power' 카테고리의 다른 글

LPM (Live Partition Mobility) 가 않될 경우... 체크 사항...  (0) 2012.07.03
env_chk.sh  (0) 2012.06.28
awk 활용 구문 정리  (0) 2012.06.28
diff 와 sdiff (문자열비교)  (0) 2012.06.28
AIX & HMC에 등록된 ssh-key 삭제하기  (0) 2012.06.25
블로그 이미지

Melting

,