shell备份学习

备份传输 ftp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#!/bin/bash
#Author:LYR
#Time:2021-10-03 23:24:40
#Name:app.sh


ftp -inv <<EOF
	open 192.44.11.6
	user ftp_user user_pwd
	
	cd /tmp
	# 1.txt 上传到 对方 tmp 目录
	put 1.txt
	byte
	# 退出
EOF

	

man ftp 查看 目录

-v Verbose option forces ftp to show all responses from the remote server, as well as report on data transfer statistics.

-i Turns off interactive prompting during multiple file transfers.

-n Restrains ftp from attempting “auto-login” upon initial connection. If auto-login is enabled, ftp will check the .netrc (see netrc(5)) file in the user’s home di‐ rectory for an entry describing an account on the remote machine. If no entry ex‐ ists, ftp will prompt for the remote machine login name (default is the user iden‐ tity on the local machine), and, if necessary, prompt for a password and an ac‐ count with which to login.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
#Author:LYR
#Time:2021-10-03 23:24:40
#Name:app.sh
 
d=`date +%Y-%m-%d-%H-%M-%S`

function auto_ftp
{
	
ftp -inv <<EOF
	open 192.44.11.6
	user ftp_user user_pwd
	
	cd /tmp
	# 1.txt 上传到 对方 tmp 目录
	put 1.txt
	byte
	# 退出
EOF


}