The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Convert Epoch time format to normal date time format in the same file rk4k Shell Programming and Scripting 3 11-19-2008 10:04 PM
Help writing shell script in c++ format deadleg Shell Programming and Scripting 2 03-07-2008 10:08 AM
Cron time format new2ss Shell Programming and Scripting 1 09-12-2006 04:04 AM
is there any way to know how much time process was running from the moment it started umen UNIX for Dummies Questions & Answers 2 04-03-2006 01:19 AM
Script to run 100jobs at a time from cron skneeli Shell Programming and Scripting 2 03-22-2006 05:07 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-19-2009
jrush jrush is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 2
Cool Different time format in script, started in shell or in cron

I try to write a python script, which analyze user logon time with "who" command.
When i start script in bash, i get this result:
USER=mnadmin tty7 2009-04-18 11:37 (:0)
But when i start script in cron, i get result like this:
USER=mnadmin tty7 Apr 18 11:37 (:0)

I see - script have different environment in both cases, but i dont know where is time format defined...
I want to get a time format like i get it in bash.
Any ideas?
  #2 (permalink)  
Old 04-19-2009
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,949
Take a look at en environment variables LANG, LC_ALL, LC_TIME
  #3 (permalink)  
Old 04-19-2009
jrush jrush is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 2
Quote:
Originally Posted by pludi View Post
Take a look at en environment variables LANG, LC_ALL, LC_TIME
Yes! It is !
I add environment variable inside my script:
os.environ["LANG"]="en_US.UTF-8"
and now the time is in right format:
USER=mnadmin tty7 2009-04-19 12:04 (:0)

Thanks!
Closed Thread

Bookmarks

Tags
cron, format, python, time

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:44 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0