Archive for the ‘Unix’ category

VMWare and slow clocks


I have noticed recently that most of our VMWare instances (and we are running decent fleet of them for the ATG Lab as well as internal system) if left without time synchronization, will loose get late quite a bit: some of them as much as hour or more a week.

Unix date command unfortunately belongs to those commands that I am having troubles to remember and everytime I have to use it with parameters, I end up googling for examples …

The following snippet is useful when correcting only time portion:

[tkuser@jci-app ~]$ date
Sat Jan 3 11:28:12 EST 2009

[tkuser@jci-app ~]$ sudo date -s "13:45"
Sat Jan 3 13:45:00 EST 2009

[tkuser@jci-app ~]$ date
Sat Jan 3 13:45:04 EST 2009

Easy access to log files


Here is the scoop: I need to provide access to multiple log files spread across multiple directories of multiple machines. For example – the JBoss log files and nohup.out, ATG log files, and so on – so that the testers can see what happened on server side when something looks fishy on front end.

One option would be to write a document that contails IP’s of the machines, create user accounts, make sure that they have just enough access rights to see the files but not disturb anything else …

Other option is to leverage the already installed Python across all the servers. I wish it was Ruby, but one cannot have everything.

On each machine, I created directory – e.g. ~/webaccess and made symbolic links to all log files or log directories required. Then I placed this python script into the directory:


import SimpleHTTPServer
import SocketServer

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

PORT = 9999

Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

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

print "serving at port", PORT

and started it as

nohup ./ &

From this moment on, all files linked (actually all files in subtree of server directory) are accessible by going to http://SERVERNAME:9999/ – which shows directory listing for linked files.

On one of the machine, I have placed additional file – index.html that contained links to all other server names.

Thanks to this page for inspiration.