Automatic FTP script
Use the following script to implement automatic FTP, transfer the files you need to the desired place, or capture the files from somewhere.
CD/path_you_want_to_upload (download)
FTP-n
Open ip_address
User Username Password
ASCII (or bin)
Put * (or get)
Batch configure SSH mutual trust script and ssh mutual trust script
During large-scale automated deployment, we often need to configure SSH mutual trust on the server so that the automated script can log on to the remote server without password. The general steps to manually configure SSH mutual trust are as follows:
Now there is a need to take a remote file below the image, download to the local, and delete the successful download of the file, and the remote directory of the image will be added at any time. Suppose that if all the scripts are written, then it is OK to call the scheduled task on Windows and execute the script on time, and Linux can use Cronjob as well. The ge
the phyaddr.txt file, jump from the first line to the next line, that is, start from the third line, and set the value to the Mac variable, for example, physical address .........: 00-e0-fc-0c-a8-4f. Each continuous value is a symbol.Symbol 1: physicalSymbol 2: address.Symbol 3 :.Symbol 4 :.Symbol 5 :.Symbol 6 :.Symbol 7 :.Symbol 8 :.Symbol 9 :.Symbol 10 :.Symbol 11 ::Symbol-E0-FC-0C-A8-4FTokens = 12. Now you should understand it, but it is worth not
FTP is a common application for accessing files, and it is also used for daily backups. This cyclical effort will undoubtedly need to be done through automated scripting. This system is CentOS7This experiment requires you to do the following:1. Modify the FTP server configuration file /etc/vsftpd/vsftpd.conf, the anon_upload_enable=yes, the previous comment is re
Share a self-written mysql automatic backup script, timed execution settings, and windows automatic FTP. Please advise.
Prerequisites: vsftpd is enabled on the mysql database server, and an appropriate account is configured for FTP
Step 1: Compile the mysql Automatic Execution script
#!/bin/sh
#mysql_db_backup.
regularly clean up the old backup files on FTP.
In fact, MySQL backup does not need to be retained for too long. It would be nice to have the function of automatically clearing old backup files. However, I found this script on the Internet, but it may not meet my needs. Therefore, you can only manually change the previous Shell script.
First, we need to determin
-3day + "%Y%m%d"). tar.gz
Cd/home/backup
#导出数据库, a database with a compressed file
For DB in '/usr/local/mysql/bin/mysql-u$mysql_user-p$mysql_pass-b-n-e ' show DATABASES | Xargs '; Todo
(/usr/local/mysql/bin/mysqldump-u$mysql_user-p$mysql_pass ${db} | gzip-9–> ${db}.sql.gz)
Done
#压缩数据库文件为一个文件
Tar zcf/home/backup/$DataBakName/home/backup/*.sql.gz
Rm-rf/home/backup/*.sql.gz
#发送数据库到Email, if the database is c
Preparations: lftp must be installed in VPS in advance. lftp is powerful. CentOS directly executes: yuminstalllftp and Debian execute: apt-getinstalllftp. You need to create the/home/backup/directory on VPS and the backup directory on FTP. If there are not many VPS databases, you can use Godaddy free space (10 GB space, 300
Preparations:
Lftp needs to be installed in VPS in advance. lftp is powerful and can be directly executed in CentOS:Yum install l
1 Ensure that you are in the home directory (if not, run: cd/home)2 New Backup folder (command: mkdir backup)3) New Script backup.shVI backup.sh
Copy the following code (after replication: wq! to save):
Copy Code code as follows:
#!/bin/bash
#你要修改的地方从这里开始
Mysql_user=root #mysql用户名
mysql_pass=123456 #mysql密码
Ftp_user=vmvps #ftp用户名
ftp_pass=123456 #ftp
Findf.close ()
Exit Do
End If
Set R=fso.opentextfile (F, 2, true)
R.write s
D2=f.datelastmodified
If D2>=d then Exit Do
Loop
End If
Next
Set Fs=flr.subfolders
For each F in FS
Traversal (F.path)
Next
End Function
Traversal (Flrname)
' MsgBox ("done!" Count "Files were modified successfully.")
WScript.Echo "Done!" Count "Files were modified successfully." ' Value popup by ' WScript.Echo ' Can is received by. Bat easily
Wscript.Quit count ' This variable ' c
0.079 seconds (1.5e + 02 Kbytes/s)
6.6.3.2 FTP command Summary
Life order
Release
ASCII
Enter the ASCII mode, which is used to transmit text files.
Binary
The binary mode is used to transmit binary files.
CD
Change the working directory of the remote machine.
known as a batch program or script) to simplify routine or repetitive tasks.Second, bat common syntax commandsEcho commandTurn on echo or turn off the request Echo feature, or display a message. If there are no parameters, the echo command displays the current echo setting.Grammar echo [{on| OFF}] [message]
/echo Hello World In practical applications we will combine this command with a redirect symbol (al
First, install email send program
Copy Code code as follows:
Yum Install SendMail Mutt
Second, install the FTP client program
This script needs to use an FTP client program to upload files to the FTP space, so you must install the FTP client, o
Scripting Features:The script is run by a timed scheduled task, and the specified file is uploaded periodically.Before writing this script, sometimes the network is unstable, always upload failed. Write a loop to pass, but do not know how to get the error state of the FTP return, later Niang to the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.