Sheel script
preface
According to? It is important to write an automated script if you are constantly updating code and need to deploy it manually to the server!!
Copy files to the server
SCP -r filename account @server ADDRESS: directory Command Parameter -r Recursive folder Optional: directory. The default directory is the root directory
SCP - r prototype. Zip [email protected]: / data/below/prototypeCopy the code
Connect to the server and execute the command
- Connect to the server and run batch commands
SSH [email protected] << remotessh // Connect to the server << remotessh is a self-defined name CD /data/wwwroot/prototype exit remotessh // End the script inside the serverCopy the code
- Connect to the server and execute a simple command
SSH [email protected] "CD/data; ls -l"Copy the code
Connecting to the server bypasses manual password entry
- The connection server security key
- Log in password-free with sshPass