Update the local code to the server shell script
The first problem with Ubuntu as a development machine OS is to put the updated code on the test server to run
Www.ahlinux.com
Before using Windows with WINSCP Update code to the server up
There are no programs like WINSCP under Ubuntu, you can only write a simple script to do this kind of thing.
Shell Code www.ahlinux.com
#要更新的的文件数组 the path to the relative root directory
file_array= ("xxx/xxxxx.py" \
"xxx/xxxxx.py")
#我机子项目根目录
My_dir= "/home/xxx/workspace/xxx/"
#开发机项目根目录
net_dir= "[Email protected]:/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.
But doing this may require you to enter the server password repeatedly
Can perform:
Shell Code
SSH-KEYGEN-T RSA
Generate a pair of keys under the user's home directory/.ssh directory
Id_rsa private Key
Id_rsa.pub Public Key
Copy the public key to the remote host and write to the authorization list file
Shell Code
Touch/root/.ssh/authorized_keys
Cat/root/.ssh/id_rsa.pub >>/root/.ssh/authorized_keys
It's actually copying the contents of the id_rsa.pub inside the Authorized_keys.
- This article is from: Linux Learning Network
Update the local code to the server shell script