Wednesday, December 16, 2009

How to see future file timestamps in Solaris

I know I've spoken about timestamps already, but I'd like to further expand the topic.

While there's a great GNU stat command in Linux systems, there's no such thing in Solaris by default, and so you usually depend on ls command with various options to look at file's creation, modification or access time.

The standard /bin/ls command in Solaris doesn't always show you the full timpestamp, usually if it's about a time too far in the past or a bit into the future – so today I'm going to show you a trick to work around it and still confirm such timestamps for any file.
Standard ls command in Solaris doesn't always show full timestamps
Here's an example: BigBrother monitoring suite creates np_ files for internal tracking of times to send out email notifications. It deliberately alters the timestamps so that they're set for a future date – that's how it tracks the time elapsed between the event and the next notification about it.
However, not all of these np_ files are shown with their full timestamps, some just show the date, with no time:
solaris$ ls -l *myserver1*
-rw-r--r-- 1 bbuser bbgroup 48 Jan 9 2009 np_greys@solaris-server.com_myserver1.conn
-rw-r--r-- 1 bbuser bbgroup 50 Jan 9 10:41 np_greys@solaris-server.com_myserver1.cpu
-rw-r--r-- 1 bbuser bbgroup 51 Jan 9 10:41 np_greys@solaris-server.com_myserver1.disk
-rw-r--r-- 1 bbuser bbgroup 53 Jan 9 10:36 np_greys@solaris-server.com_myserver1.memory
-rw-r--r-- 1 bbuser bbgroup 51 Jan 9 10:41 np_greys@solaris-server.com_myserver1.msgs
-rw-r--r-- 1 bbuser bbgroup 52 Jan 9 2009 np_greys@sola

1 comment: