Archive

Posts Tagged ‘python’

quick configuration of python httpd server

November 28th, 2013 Comments off

Let's assume that you want to copy files from server A to server B, and you have found that no scp available, but wget is there for use. Then you can try run one python command and use wget to download files from server A.

Here's the steps:

On server A:

cd <directory of files you want to copy>

python -m SimpleHTTPServer 8080 #notice the output of this command, for example, "Serving HTTP on 0.0.0.0 port 8080 ..."

Now you can open browser and visit http://<hostname of server A>:8080. You will notice files are there now.

On server B:

wget http://<hostname of server A>:8080/<files to copy>

After you've copied files, you can press control+c to terminate that python http server on Server A. (Or you can press ctrl+z, and then %<job id> & to make that python httpd server run in background)