LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Need help with who -b command (https://www.linuxquestions.org/questions/linux-newbie-8/need-help-with-who-b-command-4175465603/)

manickaraja 06-11-2013 02:32 PM

Need help with who -b command
 
Hi,
I am using who -b command to find out last reboot (host) date/time and insert data into Oracle. However when I issue this command directly in shell prompt it is giving in different format and when the same script is called through Java (front end) it is giving different format. However when I say which who both resolves to same "who". Please help me to resolve the same.

From Unix prompt:
who -b
system boot 2012-12-07 02:22
which who
/usr/bin/who

From Program log file (using set -x):
+ which who
/usr/bin/who
+ who -b
system boot Dec 7 02:22

Thanks
Manick.

druuna 06-11-2013 03:03 PM

Too my knowledge, the output of the who command is influenced by the locale setting.

Code:

$ echo $LC_TIME
nl_NL.utf8
$ who -b
        system boot  2013-06-11 07:48
$ LC_TIME=POSIX
$ who -b
        system boot  Jun 11 07:48

I make it a habit of setting the locale to POSIX in my scripts (export LC_ALL=POSIX). This might not be preferable in some cases, though. Something similar could probably be done with java.

manickaraja 06-11-2013 06:35 PM

Thanks for the hint. Setting LOCALE did resolve the issue.

Thanks,
Manick.


All times are GMT -5. The time now is 03:24 AM.