[Linux]batch shell(tar,ftp,sftp)

Linux 2017.08.08 14:07 Posted by 애플자라

----------------------------------------
* FTP
----------------------------------------
#!/bin/sh

HOST=IP명
USER=계정
PASSWORD=패스워드

#folder=$(date +'%Y%m%d')
folder_tar=$(date +'%Y%m%d')".tar"

cd /var/backup/web/
#tar cvf $folder_tar $folder

#backup=$(date +'%Y%m%d')".*"

ftp -i -n <<HERE
     open $HOST
     user $USER $PASSWORD
     bin
     prompt
  cd IT/06_DbBackup/DLP/DEFCON5/WEB/
     put $folder_tar
     close
     bye
HERE
exit 0


----------------------------------------
* SFTP
----------------------------------------
#! /bin/sh

HOST=IP명
USER=계정
PASSWORD=패스워드

#folder=$(date +'%Y%m%d')
folder_tar=$(date +'%Y%m%d')".tar"

cd /var/backup/web/
#tar cvf $folder_tar $folder

#backup=$(date +'%Y%m%d')".*"

sftp 계정@HOST=IP명 << EOF
cd /c/IT/06_DbBackup/DLP/DEFCON5/WEB/
put $folder_tar
quit
EOF

 

'Linux' 카테고리의 다른 글

[Linux]mount nfs 에러  (0) 2017.11.15
[FTP]SecureCrt X/Y/Zmodem  (0) 2017.09.18
[Linux]batch shell(tar,ftp,sftp)  (0) 2017.08.08
[SSH]접속툴(telnet/SSH/SFTP)  (0) 2017.08.03
[Linux]Samba 업데이트  (0) 2017.06.13
리눅스 이더넷 맥 주소 확인  (0) 2017.02.24