Thursday, April 5, 2018

Script to expose unix filesystem in web browser - A very Useful Script

Dear Friends


You can use this script to view  unix file system ( for example : JVM Logs ) in web browser, without logging to server.

Let me know, if you feel any issue in executing this script.


[sanpoc@pwebspherebox:/jboss/poc]$ cat SimpleHTTPLog.py
#!/usr/bin/python

import SimpleHTTPServer
import SocketServer
import sys

# minimal web server.  serves files relative to the
# current directory.

#PORT = 44444
PORT = int(sys.argv[1])

Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

Handler.extensions_map.update({
'': 'application/octet-stream', # Default
'.out': 'text/plain',
'.log': 'text/plain'
})
httpd = SocketServer.TCPServer(("", PORT), Handler)

print "serving at port", PORT
httpd.serve_forever()


This script output will be like :
You can expose Websphere installation root directory to webbrowser and can view all files and configurations easily ( Please note, this is not recommended . Use it only during Weekend Oncalls  or when required or  when we want to verify the logs without logging to box or you want to share the log with developer but the log size is too big ).


No comments:

Post a Comment

LINUX : turn OFF password expiration / aging

Hi Team If you are using linux as OS and want to set password as never expiry for any specific user, please follow the steps mentioned be...