Update the shell script of local code to the server
Source: Internet
Author: User
The first problem with updating the local code to the server's shell script using Ubuntu as the development Machine OS is to put the updated code on the test server before running www.2cto.com on windows, the Winscp is used to update the code there is no program similar to Winscp under ubuntu on the server... the first problem with updating the local code to the server's shell script using Ubuntu as the development Machine OS is to put the updated code on the test server before running www.2cto.com on windows, the Winscp is used to update the code there is no program similar to Winscp in ubuntu on the server, you can only write a simple script to do this. the Shell code www.2cto.com # The File array to be updated is relative to the root directory path file_array = ("xxx/xxxxx. py "\" xxx/xxxxx. py ") # my sub-project root directory my_dir ="/home/xxx/workspace/xxx/"# development Machine Project root directory net_dir =" xxx@192.168.1.xxx: /usr/local/xxx/"length =$ {# file_array [@]} echo $ {length} for (I = 0; I <$ {length }; I ++ )); do scp $ {my_dir }$ {file_array [$ I] }$ {net_dir }$ {file_array [$ I]} done is actually a simple loop to execute the scp command. you may need to enter the server password again to execute: shell code ssh-keygen-t rsa in the user's main directory /. generate a pair of key id_rsa private key id_rsa.pub public key under the ssh directory to copy the public key to the remote host, and write the authorization list file Shell code touch/root /. ssh/authorized_keys cat/root /. ssh/id_rsa.pub>/root /. ssh/authorized_keys is actually copying the content in id_rsa.pub to authorized_keys.
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.