Compare Last Modified Time across Time Zone


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Compare Last Modified Time across Time Zone
# 1  
Old 02-10-2009
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 GMT, and client is at GMT+5). I need to do file synchronization between this 2 machines, taking the latest updated file from server, and scp it to client.

The problem I face is both machines are in different time zone, so that the last modified time doesnt not reflect the actual different.
Eg: for file /tmp/test.txt in both machines
Server: last modified time is Jan 01, 2009 02:00:00 (at GMT 0)
Client: last modified time is Jan 01, 2009 06:00:00 (at GMT +5)
From the surface, it looks like the file in Client is the latest. But when you consider it with time zone, you will find that the file in Server is the latest version.
After manually fine tuned both file with GMT0:
Server: last modified time is Jan 01, 2009 02:00:00 (at GMT 0)
Client: last modified time is Jan 01, 2009 01:00:00 (at GMT 0)

So, anyone help me to solve this issue?

Thank you!
# 2  
Old 02-11-2009
You can change the time zone value to same in both servers with the help of environment variable TZ.

Eg:
TZ=Asia/Calcutta
export TZ

Execute your compare commands after setting same time zone in both servers.

Note: This change will not reflect another sessions.
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

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

4. 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

5. Homework & Coursework Questions

Grep for modified time

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: is it possible to come up with a list of files that are modified before a certain number of hours only using the... (3 Replies)
Discussion started by: momo.reina
3 Replies

6. Shell Programming and Scripting

Grep for modified time

is it possible to come up with a list of files that are modified before a certain number of hours only using the grep command? ex. list files that were modified less than 10 hours ago i've only managed to list files that were created on the same day, i can't seem to figure out how to work... (3 Replies)
Discussion started by: momo.reina
3 Replies

7. UNIX for Dummies Questions & Answers

Need to get 4 Hrs back time and compare with successive time

Hi all, I am working on a script in which i need to get 4 hrs back time from the current time which i got from this perl function : `perl -e 'print localtime(time() - 14400) . "\n"'` now i need to get this in a loop and increment that time by 15 minutes i.e i=900(=15minutes) `perl... (2 Replies)
Discussion started by: maanik85
2 Replies

8. Shell Programming and Scripting

getting last accessed and modified time together

actually, i'm making an Intrusion Detection System for education purpose (for project) using Bourne shell. The problem I get in that is:- 1. My application should check if there's some modification or alteration in the directory. 2, For that thing, I need to have every attribute of file and... (1 Reply)
Discussion started by: raku05
1 Replies

9. UNIX for Advanced & Expert Users

Modified time

How do you change the modified time of a file on UNIX?? (4 Replies)
Discussion started by: frank
4 Replies
Login or Register to Ask a Question