Sponsored Content
Full Discussion: check files updation
Top Forums Shell Programming and Scripting check files updation Post 302451982 by jim mcnamara on Wednesday 8th of September 2010 08:00:57 PM
Old 09-08-2010
15 minutes is 900 seconds. Get now in epoch seconds the last mtime of the file in epoch seconds. subtract. if the result > 900 seconds the file was not updated in the last 15 minutes.

Code:
now=$(date +%s)
ftime=$(date -r filename  +%s)
$d=(echo "$now  $ftime" | awk '{ print $1 - int($2) }' )
if [ $d -gt 900 ] ; then
   echo 'File not updating'
else 
   echo 'file OK'   
fi

 

10 More Discussions You Might Find Interesting

1. Programming

Directory updation Notification?

Hi, I'm a UNIX newbie .. so forgive me if this question sounds dumb. :) Is it possible for Unix to notify a process that a particular directory has been updated? Rather that the process constantly polling the directory ... Awaiting your replies .. Thanks, VJ (6 Replies)
Discussion started by: vjsony
6 Replies

2. Linux

gcc updation on Linux machine

Hi All, I already have gcc complier installed in my machine. Its version is : gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) I am not sure whethere it's is latest gcc version available. I want to update my gcc version. Can anyone please suggest me what is the latest and stable gcc... (1 Reply)
Discussion started by: bisla.yogender
1 Replies

3. Red Hat

RPM Updation & Keeping User Change files during removal

Hi All, I have a RPM for an Java based application. Currently it works fine. But recently I want to implement that when newer packages gets installed over the older one, the rpm should only update the older files with the newer one (I know this could be done by rpm -Uvh xxx.rpm), but it... (0 Replies)
Discussion started by: jw_amp
0 Replies

4. AIX

Problem with updation of 'quota'

Hi, We have recently implemented 'quota' concept for the unix users. softlimit - 230MB hardlimit - 250MB We have applied the quota when few of users are more than the hardlimit,issue is that even though the users cleared the space, still its 'quota' was not updating properly. For some... (0 Replies)
Discussion started by: girish_satyam
0 Replies

5. Shell Programming and Scripting

to check files updation in sys time

Dear All, Pls help me on this issue. i want to write a script to check whether files updation happening in cuttent time or not. i have set of files in directory which wil update in time basis.. Requirement: If the files are updating in system time i just want to print "files are... (6 Replies)
Discussion started by: steve2216
6 Replies

6. Shell Programming and Scripting

Perl code to check date and check files in particular dir

Hi Experts, I am checking how to get day in Perl. If it is “Monday” I need to process…below is the pseudo code. Can you please prove the code for below condition. if (today=="Monday" ) { while (current_time LESS THAN 9:01 AM) ... (1 Reply)
Discussion started by: ajaypatil_am
1 Replies

7. UNIX for Dummies Questions & Answers

Check for updation/error/stuck of logs

Hi All, I'm a newbie in Linux Programming.:) Got some 500 processes running and I have around 20-30 logs updating for every 2mins on a server. The logs which i'm referring usually contains book name,run ids(not PID's),process name etc etc. I'm interested in finding out whether some particular... (1 Reply)
Discussion started by: Nand Kishor
1 Replies

8. Shell Programming and Scripting

Config file auto-updation

Hello All, I need to update my .cfg file which is used in the script for almost all runs. myfile.cfg file: var=1 var1=1 run=0 script: #! /bin/sh . /mydir/myfile.cfg echo $var"\t" $var1 exit So, the requirement is that the myfile.cfg should update every time I run the... (10 Replies)
Discussion started by: PikK45
10 Replies

9. Shell Programming and Scripting

Shell script to find files in dir and updation

Hi, I have the shell script requirement mentioned below : List all java and c files or all files in directory and sub directories' in folder structure in current dir. then search for pattren1 in all files globally and replace with other string . And also check the date... (3 Replies)
Discussion started by: ammulu
3 Replies

10. UNIX for Dummies Questions & Answers

File updation on matching key

I have input file like Input.dat with below content RRD 0Z91YUn000000Lk 9000100001 103020151117 STMT151117155527001 0000 2 000000 000004 RRD 0Z91YUn00000ysj 9000100001 103020151117 STMT151117155527001 0000 3 000000 000003 RRD 0Z91YUn00001vGh 9000100002... (12 Replies)
Discussion started by: PRAMOD 96
12 Replies
FTIME(3)						     Linux Programmer's Manual							  FTIME(3)

NAME
ftime - return date and time SYNOPSIS
#include <sys/timeb.h> int ftime(struct timeb *tp); DESCRIPTION
This function returns the current time as seconds and milliseconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). The time is returned in tp, which is declared as follows: struct timeb { time_t time; unsigned short millitm; short timezone; short dstflag; }; Here time is the number of seconds since the Epoch, and millitm is the number of milliseconds since time seconds since the Epoch. The timezone field is the local timezone measured in minutes of time west of Greenwich (with a negative value indicating minutes east of Green- wich). The dstflag field is a flag that, if nonzero, indicates that Daylight Saving time applies locally during the appropriate part of the year. POSIX.1-2001 says that the contents of the timezone and dstflag fields are unspecified; avoid relying on them. RETURN VALUE
This function always returns 0. (POSIX.1-2001 specifies, and some systems document, a -1 error return.) ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +----------+---------------+---------+ |Interface | Attribute | Value | +----------+---------------+---------+ |ftime() | Thread safety | MT-Safe | +----------+---------------+---------+ CONFORMING TO
4.2BSD, POSIX.1-2001. POSIX.1-2008 removes the specification of ftime(). This function is obsolete. Don't use it. If the time in seconds suffices, time(2) can be used; gettimeofday(2) gives microseconds; clock_gettime(2) gives nanoseconds but is not as widely available. BUGS
Early glibc2 is buggy and returns 0 in the millitm field; glibc 2.1.1 is correct again. SEE ALSO
gettimeofday(2), time(2) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU
2017-09-15 FTIME(3)
All times are GMT -4. The time now is 08:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy