Wednesday, September 22, 2010

Simple File Sharing with Python SimpleHTTPServer

Have you ever come across a situation where you quickly need to share a file and you lack that quick expertise to setup FTP/Apache or Websphere. Python has this in built SimpleHTTPServer which can solve this and help you share any file in seconds.

For ex. you want to share some files in /appsData.

[root@DebaTestBox debu]# cd /appsData
[root@DebaTestBox appsData]# python -m SimpleHTTPServer 18000 &

Now you can see that your SimpleHTTPServer is running on port 18000

[root@DebaTestBox appsData]# netstat -lntp | grep 18000
Active Internet connections (only servers)
tcp 0 0* LISTEN 16889/python

[root@DebaTestBox appsData]# ps -ef | grep HTTP
root 16889 16861 0 05:48 pts/0 00:00:00 python -m SimpleHTTPServer 18000

Now go to any web browser and try to see the files as below:


Yay!! That's it !!!! You are now sharing your files without setting up a dedicated weblogic or apache or any FTP Server and it did not really ask for any prior hardcore knowledge of system administration.

Network ACL check whether a port is open or not:

This can even be used to test whether a port is open between two servers when the respective services on them has NOT yet been started. Run this server on the port which you want to check on the first server and do a telnet from the other box. This is one of way how you can test a Network ACL port open or not, probably in less than 10 sec ! Yeah? Enjoy!


No comments:

Post a Comment

Why Database CI/CD?

Making the Database Part of Your Continuous Delivery Pipeline The database, unlike other software components and code or compiled co...