- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: UTC time format script output different
Operating System - HP-UX
1753569
Members
5904
Online
108796
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2009 08:52 AM
тАО01-14-2009 08:52 AM
I have a script that sources from dual.
SELECT TO_CHAR(CURRENT_DATE,'DD-MON-YY-HH24:MI:SS')
FROM dual
If I run this from command line I get the time in UTC, just like the rest of the time stamps for the script...
IE:
SELECT TO_CHAR(capture_message_create_time,'DD-MON-YY-HH24:MI:SS')
FROM v\$streams_capture
So the output would look like:
14-JAN-09-16:00:00 14-JAN-09-15:59:58
But if I run from cron...
Out put is:
14-JAN-09-10:00:00 14-JAN-09-15:59:58
Which is 6 hours out.
I source my environment in my script and TZ=UTC.
So why the difference, and how do I make it all the same?
I would like it all in either UTC, or all -6 CST
SELECT TO_CHAR(CURRENT_DATE,'DD-MON-YY-HH24:MI:SS')
FROM dual
If I run this from command line I get the time in UTC, just like the rest of the time stamps for the script...
IE:
SELECT TO_CHAR(capture_message_create_time,'DD-MON-YY-HH24:MI:SS')
FROM v\$streams_capture
So the output would look like:
14-JAN-09-16:00:00 14-JAN-09-15:59:58
But if I run from cron...
Out put is:
14-JAN-09-10:00:00 14-JAN-09-15:59:58
Which is 6 hours out.
I source my environment in my script and TZ=UTC.
So why the difference, and how do I make it all the same?
I would like it all in either UTC, or all -6 CST
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2009 10:31 AM
тАО01-14-2009 10:31 AM
Solution
The cron environment is different than that of the command line. When you run the same script from cron you have to set the user environment just like it is in the command line. I am guessing this is a database account (oracle?) so when you run this script from cron you need to initialize all the variables as they are when you login to this account on the command line. If this is indeed an oracle account you need all the oracle parameters such as ORACLE_HOME, SID, TNS etc. When you are on the unix shell command line type in the "env" command and see all the variables that have been set. Most of these are NOT setup when running in cron.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2009 12:23 PM
тАО01-14-2009 12:23 PM
Re: UTC time format script output different
Thought I did, but didn't...
Had to add TZ=UTC in my script.
Had to add TZ=UTC in my script.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP