AIX Down Under
AnthonyEnglish 270000RKFN Tags:  ntp hardware_management_conso... hmc time_zone aix power time date ibm 18,032 Views
On a virtualised system, a large number of management tasks can be done via the HMC (Hardware Management Console) or the IVM (Integrated Virtualization Manager). I sometimes come across sites where they're afraid to touch the HMC at all, so the date and time are set to whatever was shipped, and often that is out by some hours. In this post we'll look at a simple task on the HMC: setting the time.
"Who cares if the HMC time is wrong?"
Ah yes. That's the spirit. Well, here at AIX Down Under, we take punctuality seriously and frown on those who don't. And if that is not reason enough to make you tremble, think of this: when eventually your remarkably reliable hardware does record a fault for something, you may have to do a mental translation of every single HMC Event Log to work out whether your server really went down last night or some time in the last millenium.
All of the following instructions are for HMC Version 7. If you happen to be on an older version, then have a look at HMC Updates with Sunscreen.
Changing the date and time
The IBM Systems Hardware Information explains how to Change the date and time on the HMC:
HMC Management > Change Date and Time. If you select UTC in the Clock field, the time setting will adjust automatically for daylight saving time in the time zone you select.
Of course you will need to set the Time zone as appropriate for your own HMC.
You can also configure the HMC to point to an NTP server. You may already be familiar with configuring NTP on AIX. If you do the same on your HMC, it will allow you to keep the time in synch with other servers on your network. Here's what the NTP screen looks like on the HMC:
Keep the good times rolling
It's not at all hard to set the time on the HMC, and if you should ever have to sift through HMC Event logs you'll be glad you did it. So will we.
In Australia, the UK, Canada, New Zealand and many other countries, we put the date in the format of dd/mm/yy. In other words, 11/12 means 11 December, not 12 November. So today, Wednesday 11 December 2013, we have these fantastic date and time combinations:
And then, exactly 3 hours 3 minutes and 3 seconds later:
Another 3:03:03 after that, if you swap the time and date fields, you get this:
Now if you want to display those dates and times using the AIX date command, it's pretty easy to do. First, with date you can specify a field using the % sign. Here are some extracts from the date command documentation:
So, to display that first and second time/date combination above, you'd need:
date +"%H:%M:%S %d/%m/%y"
And the third one just swaps the date and the time.
date +"%d/%m/%y %H:%M:%S"
If you want to include that output as part of a log file, for example, you could do something like this:
echo $(date +"%d/%m/%y %H:%M:%S")
Now how's that for a Geek party trick?
What about US?
And if you're based in the US or some other country which uses the format mm/dd/yy, don't feel as if you've missed out. You could have done all of these number patterns on 12 November 2013 and hopefully you'll still be alive in time for the next one of these magic dates.
On AIX you can customise dates and timestamps with the date command. For more about how to do this, read this article.