In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you about how to use WINSCP to achieve deployment project automation. The article is rich in content and analyzed and described from a professional point of view. I hope you can get something after reading this article.
1. Creative background
When we are working on a project, one of the things we cannot avoid is to update and deploy the project. If it is a windows service, there is still nothing to worry about, but if the server is linux, when deploying the system, we need to enter a bunch of commands every time. Entering and leaving the file directory is very tedious and a waste of time, and sometimes we need to modify the configuration information in the file. Because the development environment is different from the formal environment, and sometimes the configuration information in the file needs to be modified, the reason for all this prompted me to have an idea: to use batch processing to help me realize the need for automated deployment.
two。 Technical introduction
This script is mainly written by using WINSCP, an open source graphical SFTP client using SSH in Windows environment, using the function of windows and linux file transfer held by weinscp, and the feature of calling linux command by using the built-in call command of winscp.
3. Script implementation process
① first needs to install WINSCP, the installation process is omitted, the software download address: after the installation is complete, use this client to link to your remote server so that you do not need to confirm the key when executing the automation script.
② enters the winscp installation location
Installation location
③ create a new document named trans.bat.bat
④ opens the document to edit the script
The first step of ⑤ is to open a connection to the remote server. The code is as follows
Open a link to the server
⑥ then switches to the specified path above the server and uploads the deployment package as follows
Note that if you need to call the linux command, you need to precede the command line with call in order to call it correctly, otherwise an error will occur.
Upload the deployment package and execute the appropriate linux command
⑦ finally exits the connection.
Exit the link
4. How to use this script
The script written above cannot be executed alone and needs to be called and executed using the winscp command, where trans.bat is the script we just wrote and log22.txt is the name of the log file created during execution
Execute the script's command
Screenshot of execution result
For convenience, we can also write this command to the batch. We create a new file named auto.bat, open it for editing, enter the following, and after saving it, we can double-click the bat to automate deployment. There is no need to enter the command.
Execute the bat above
The above is the editor for you to share how to use WINSCP to achieve deployment project automation, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.