From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <98638164531061.tru64-unix-managers.marc@archive.invalid> From: "Backhouse, Mark" Date: Wed, 04 Apr 2001 10:44:46 +0000 To: tru64-unix-managers Subject: SUMMARY: time stamp oddity X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=98638164531061 Dear All, Had various replies, which I am very grateful for. The general gist of it is that the timestamp is only displayed in that format when the: a) the file has not be touched in 6 months b) the time on the file is in the future. The way to get around this is to write the script in another language that will not reply on ls. I was sent a perl script and a c script along the same lines as what I want to do and I am most thankful to the people that sent me them. I think I will rewrite my script in perl as I am ALOT more familiar with perl than c. Thanks again. Mark ps I enclose the perl script I was sent below. #! /usr/bin/perl -w # ls.pl # ----- # Read list of files from STDIN, and produce listing similar to 'ls -ld', # but without the lunatic reformatting of dates older than 6 months. # use strict; require "ctime.pl"; use Stat::lsMode; my ($fname); while (<>) { chomp; $fname=$_; if ( -e $fname ) { my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = stat(_); # convert $mode into meaningful text my $permissions = format_mode($mode); # convert $uid into name my $n_uid = getpwuid($uid); # convert $gid into name my $n_gid = getgrgid($gid); # convert $time from seconds since Jan 1970 into ascii local time my $time = ctime($mtime); chomp $time; print "$permissions $nlink $n_uid $n_gid $size $time $fname\n"; } else { warn "ERROR: File $fname does not exist\n"; } } ----------------------------------------------------- Mark C Backhouse Unix Systems Server Manager Systems & Network Services York Health Services NHS Trust mailto:Mark.Backhouse@excha.yhs-tr.northy.nhs.uk > -----Original Message----- > From: Backhouse, Mark > Sent: 03 April 2001 09:26 > To: Tru64-Unix-Managers (E-mail) > Subject: time stamp oddity > > Dear All, > > Got a wierdity to do with timestamps. I have a script that checks the > timestamp on an NFS mounted directory every 5 minutes and if it hasn't > changed after 15 minutes ( 3 checks ) it sends me an email. It expects the > timestamp on the directory to include the time, so that when a file is put > into the directory or one is taken out the time is updated and the script > resets the counter to zero. BUT, since the timechange to BST the timestamp > on the file is: > > drwxrwxr-x 4 201 daemon 1536 Apr 3 2001 /apps/gplinks > > ie not showing the time, which is causing havoc with my script, ie the > timestamp on the file doesn't change for 24 hours! When I unmount the nfs > mount the dir then shows the correct timestamp. > > I have tried touching the directory from my end and from the server that > is nfs dir is resident. The touch at the other end works but doesn't make > any difference, and the touch from this end gives the following error: > > CLOCK:root>touch /apps/gplinks > touch: cannot change times on /apps/gplinks > > The server that is offering the directory to be nfs mounted is an IBM > rs6000 running AIX 4.3 and the server that has the directory nfs mounted > is an Compaq Alpha 1200 running Tru64 Unix v4.0F PK4. The times on the two > servers are as follows: > > rs6000: 09:20:00 > Alpha 1200: 09:22:45 > > Actually thinking about it, this started happening when the support > company dialled in and changed the time on the AIX box at about 10am. Just > to explain that one we don't support the AIX box, the support company that > supports the application running on it supports the OS. Its a long story! > > Any ideas will be gratefully received. > > Thanks in advance. > > Mark > > ----------------------------------------------------- > Mark C Backhouse > Unix Systems Server Manager > Systems & Network Services > York Health Services NHS Trust > mailto:Mark.Backhouse@excha.yhs-tr.northy.nhs.uk >