Solaris 9 Zone : Date command in crontab shows delayed(One Hour) output | Unix Linux Forums | Solaris

  Go Back    


Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

Solaris 9 Zone : Date command in crontab shows delayed(One Hour) output

Solaris


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-15-2013
judi judi is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 15 January 2014, 3:41 AM EST
Posts: 12
Thanks: 2
Thanked 0 Times in 0 Posts
Solaris 9 Zone : Date command in crontab shows delayed(One Hour) output

SOLARIS 9 Zone :

date command in crontab shows delayed(One Hour) output

Hi folks,
the date command shows the correct date and time, How ever, if the date command executed through crontab in any form of scrip the output shows as one hour delayed, similar to date -u..

Can some one help in this..
++++++++++++++++++++++++++++++++++++++++++

Date command perfectly shows

judi:root:/tmp# date
Fri Feb 15 15:08:03 MET 2013
judi:root:/tmp#

The script used to get the output to test.out

judi:root:/tmp# more test.sh
#!/usr/bin/ksh
DT=`date '+%y%m%d-%H:%M'`
LOG=/tmp/test.out
echo $DT >> $LOG
judi:root:/tmp#

the cron entry used..

* * * * * /tmp/test.sh


output of the script execution (delayed for one hour)
judi:root:/tmp# more test.out
130215-14:03
130215-14:04
130215-14:05
130215-14:06
130215-14:07
130215-14:08
judi:root:/tmp#

judi:root:/tmp# date
Fri Feb 15 15:08:10 MET 2013
judi:root:/tmp#

Moderator's Comments:
Please use CODE tags. Thank you!

Last edited by DukeNuke2; 02-15-2013 at 10:32 AM.. Reason: Added Solaris 9
Sponsored Links
    #2  
Old 02-15-2013
jlliagre jlliagre is offline Forum Advisor  
ɹǝsn sıɹɐlos
 
Join Date: Dec 2007
Last Activity: 30 October 2014, 11:42 PM EDT
Location: Paris
Posts: 4,434
Thanks: 16
Thanked 474 Times in 427 Posts
Setting the expected timezone in the script called from cron should workaround the issue, eg:


Code:
#!/bin/ksh
export TZ=Europe/Paris
DT=`date '+%y%m%d-%H:%M'`
LOG=/tmp/test.out
echo $DT >> $LOG

Alternatively, set/fix TZ in /etc/default/init and reboot the zone.

Last edited by jlliagre; 02-15-2013 at 10:38 AM..
The Following User Says Thank You to jlliagre For This Useful Post:
judi (02-25-2013)
Sponsored Links
    #3  
Old 02-19-2013
judi judi is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 15 January 2014, 3:41 AM EST
Posts: 12
Thanks: 2
Thanked 0 Times in 0 Posts
Thanks for your reply jlliagre
the time zone is properly set and even server had a reboot after the time zone settings..
    #4  
Old 02-19-2013
jlliagre jlliagre is offline Forum Advisor  
ɹǝsn sıɹɐlos
 
Join Date: Dec 2007
Last Activity: 30 October 2014, 11:42 PM EDT
Location: Paris
Posts: 4,434
Thanks: 16
Thanked 474 Times in 427 Posts
Did you modify the test.sh script as I suggested ?
Sponsored Links
    #5  
Old 02-19-2013
judi judi is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 15 January 2014, 3:41 AM EST
Posts: 12
Thanks: 2
Thanked 0 Times in 0 Posts
yes I modified the test.sh, Now the output is perfect, still I am afraid this cannot be advised to all users and application cronjobs right ?
Sponsored Links
    #6  
Old 02-19-2013
jlliagre jlliagre is offline Forum Advisor  
ɹǝsn sıɹɐlos
 
Join Date: Dec 2007
Last Activity: 30 October 2014, 11:42 PM EDT
Location: Paris
Posts: 4,434
Thanks: 16
Thanked 474 Times in 427 Posts
The clock is correct, the timezone setting is not for some reason. Please provide more clues/evidences.
Sponsored Links
    #7  
Old 02-20-2013
judi judi is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 15 January 2014, 3:41 AM EST
Posts: 12
Thanks: 2
Thanked 0 Times in 0 Posts
Sorry , I dont have any clue and totally confused.. Please be more specific on what else we can check..
Also I did not find any thing interesting (about time settings) in /etc/.profile..
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell Scripts - shows today’s date and time in a better format than ‘date’ (Uses positional paramete citizencro UNIX for Dummies Questions & Answers 3 04-11-2011 09:03 PM
date command issue from crontab pritish.sas Shell Programming and Scripting 1 05-28-2010 03:24 AM
Crontab for every minute or every hour kaushik02018 Shell Programming and Scripting 1 01-15-2010 10:11 AM
getting the date in crontab command pranavagarwal UNIX for Dummies Questions & Answers 7 12-12-2007 12:09 PM



All times are GMT -4. The time now is 09:32 AM.