Unsolved
This post is more than 5 years old
11 Posts
0
608
July 2nd, 2015 23:00
mminfo output in scripts - UK vs US dates
I have two Red Hat boxes, both the same version of Red Hat and patch status, built from the same build. They both have a Networker server running, one runs 8.1.1.2 and the other 8.2.1.4 .
I have a Python 2.6 script which analyses the output from the savegroup notification, gets some information for each client's savesets from mminfo, and writes a single line summary for the client to a text file. The same script runs on both Networker servers.
I'm in the UK and all our servers have platform locale set to en_GB so usually we see our dates as DD/MM/YY from mminfo.
I am having a lot of difficulty getting the mminfo call from the Python script on the 8.1.1.2 box to return the date in UK format.
The input to the mminfo command is not a problem. I use the "wordy" version from the notification eg "Jul 3 06:30:20 2015". Its the output that's a problem.
Both boxes do it correctly when mminfo is called from the command line, or run in the Python interactive debugger - so its a tricky problem to spot in development! However when run "for real" out of the debugger it plain that that the date is MM/DD on the 8.1.1.2 box.
I have tried using "LC_ALL=en_GB " which made no difference at all.
I suspect that the call from Python undebugged may not be a shell call, but my Python is not that strong and I don't have hours to google away, and I suspect the lower version is ignoring platform locale in non-shell calls. But that's two guesses!
Can anyone shed any light on the apparent 'feature' of mminfo ignoring locale in a (suspected) non-shell call?
Can anyone positively say that yes, this is due to a difference between the two versions, rather than my platforms?
And more importantly, how can I test which format of date mminfo will return, other than an amount of coding to compare a test sample with the output from the "now" date [if MM is 01 and date month is 'Jan' etc ] which looks pretty amateurish to me.
I will at some point be upgrading the lower server, but as I have multiple servers (5 at present) and we upgrade slowly due change processes, there will always be servers at different levels - and will this problem come back at other levels?
My other potential tactic is to use "LC_ALL=C " to force the date to US so that at least I can guarantee the output. But its not the proper solution and does little to further the greater knowledge.
We rely heavily on the stats produced by the script and they must be right. Anyone else seeing this as a problem?
0 events found


ble1
6 Operator
•
14.4K Posts
•
56.2K Points
0
July 9th, 2015 03:00
As mminfo manual says, local locale will lead the output. This means that mminfo output will depend on locale (which you claim not to be the case).
It is still not clear to me what your problem exactly is - perhaps you may wish to show it exactly when and where compared to what is ok and to what is not. Fact that you use script should mean that you can manipulate data any way your want. I use on all my backup infra boxes en_US localed despite location - can't really see what exactly one would achieve with backup server running in different locale. I think your best bet would be en_US on UK box.