Time Zone and find command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Time Zone and find command
# 1  
Old 03-28-2012
Time Zone and find command

I need some help trying to figure this out. I have written a bash script that uses gnu find command every minute to check any incoming/outgoing files and then take appropriate action. Everything works fine if we are in the US time zone but as soon as China and Europe time-zone come in my script won't do the trick. Users can't wait that long to get their files processed. How can I make my script scan for every new file regardless of time-zone?
# 2  
Old 03-28-2012
You haven't posted your find script, therefore I have no idea why it isn't working.

Try checking the ctime instead of the mtime if they're uploading bad timestamps.
# 3  
Old 03-28-2012
Sorry I haven't scripted this yet but I left out a few details. Files are being ftp/copied/nfs from different zones and they retain their time-stamps. So for example if my script run every minute which is in US then it will definitely not see the new file coming in from China, which I think they are 13 hours ahead. How do I solve that time-stamp issue?
# 4  
Old 03-28-2012
Have you tried checking ctime(change time) instead of mtime(modification time)?

ctime should be the last time the file's inode was changed -- for a brand-new file, that'd be when the file was created. The ctime probably has a timestamp assigned by your system, not theirs.
# 5  
Old 03-28-2012
One big question.
Is the server clock set to UTC ?

What should happen with an International server is that all file and database timestamps are held in UTC. Also unix cron is run in UTC with individual crontab lines prepended with the correct TZ environment variable. Each user or reporting process then has their timezone set (with the TZ environment variable) such that they see file or database item timestamps in their local timezone.

It would really help to post what Operating System you are running on this server. On many, the description of TZ is in man 5 environ .

Last edited by methyl; 03-28-2012 at 06:44 PM.. Reason: beautification
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert UTC time into current UNIX sever time zone

Hi guys thanks for the help for my previous posts.Now i have a requirement that i download a XMl file which has UTC time stamp.I need to convert UTC time into Unix server timezone. For ex if the time zone of unix server is CDT then i need to convert into CDT.whatever may be the system time... (5 Replies)
Discussion started by: mohanalakshmi
5 Replies

2. Solaris

showing 2 different time zones in global zone and nonglobal zone

can some one help me out as it is showing 2 different time zones in global zone and nonglobal zone .In global zone it is showing in GMT while in nonglobal zone i it showing as PDT. System in running with solaris 10 (3 Replies)
Discussion started by: ravijanjanam12
3 Replies

3. Solaris

Find command output gives one day before time stamp

Hi All, I am listing the files which are 4 hours older. For this first I have creted a dummy file with the 4 hours before timestamp, then I am using the below find command, find /path/ -type f ! -newer 4_hours_oledr_file -exec ls -lrt {} \; I am getting the files which are older than... (13 Replies)
Discussion started by: velava
13 Replies

4. Solaris

modifying date and time and time zone on solaris 5.10 with (redundant server) veritas

I have a cluster of two Solaris server (veritas cluster). one working and the other is standby I am going to change the date on them , and am looking for a secure solution as it is giving an important service. my opinion is that the active one doesn't need to be restarted (if I don't change the... (1 Reply)
Discussion started by: barry1946
1 Replies

5. AIX

Time Zone for a User Different From Server Time

Hi, A server runs on EDT. Can I set a user with time-zone GMT without changing the server time? regards, Roshni (1 Reply)
Discussion started by: RoshniMehta
1 Replies

6. UNIX for Advanced & Expert Users

To find the time of excution of a particular unix command

Hi experts, It would be grateful if you can guide me on the following, 1.How to find the time of excution of a particular unix command. 2. How to find the terminal (IP Address) from where that particular unix command was excuted. 3. How to find the user who executed that particular unix... (1 Reply)
Discussion started by: apsprabhu
1 Replies

7. Shell Programming and Scripting

Compare Last Modified Time across Time Zone

Hi, I'm new to shell script programming, I only have Java programming background. I'm writing a shell script to do file synchronization between 2 machines that located at different time zone area. Both machine were set its time zone according to its geographical location (Eg: server is at... (1 Reply)
Discussion started by: python
1 Replies

8. Shell Programming and Scripting

find command takes a lot of time ( can I skip directories)

I have a file called "library" with the following content libnxrdbmgr.a libnxrdbmgr.so libnxtk.a libnxtk.so libora0d_nsc_osi.so I am trying to locate if these libraries are on my machine or not. find command runs for about few seconds and hangs after this. Can someone please help me and... (3 Replies)
Discussion started by: knijjar
3 Replies

9. UNIX for Dummies Questions & Answers

Command to find last time file was opened

New to unix .. Is there a simple command or utility that will tell me when the last time a file was opened/used? (3 Replies)
Discussion started by: sbr262
3 Replies
Login or Register to Ask a Question