LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-23-2014, 09:47 AM   #1
mrajdeep
LQ Newbie
 
Registered: Aug 2011
Distribution: UBUNTU 10.04 Lucid Lynx
Posts: 17
Blog Entries: 1

Rep: Reputation: Disabled
command to find out elapsed time of logfile since last write


Hi, I need to write a script which will continuously monitor a logfile and if nothing is written in that file for 500 miliseconds it will invoke a kill -3 signal to generate core dump. Any help or suggestion to achieve this is highly appreciated.
 
Old 06-23-2014, 09:51 AM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Code:
[schneidz@hyper ~]$ touch mrajdeep.txt
[schneidz@hyper ~]$ stat mrajdeep.txt 
  File: `mrajdeep.txt'
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d	Inode: 186873      Links: 1
Access: (0664/-rw-rw-r--)  Uid: (  500/schneidz)   Gid: (  500/schneidz)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2014-06-23 10:51:14.306979323 -0400
Modify: 2014-06-23 10:51:14.306979323 -0400
Change: 2014-06-23 10:51:14.306979323 -0400
 Birth: -
 
Old 06-23-2014, 10:29 AM   #3
mrajdeep
LQ Newbie
 
Registered: Aug 2011
Distribution: UBUNTU 10.04 Lucid Lynx
Posts: 17

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Thanks for your response, but how do I determine if 500 miliseconds have passed since the file was last modified.
 
Old 06-23-2014, 10:32 AM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
maybe the awk command can help check the difference in time... maybe you could convert the yyyy-mm-dd hh:mm:ss.xxxxxxxxx into some sort of unix time ?

Last edited by schneidz; 06-23-2014 at 10:34 AM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to capture elapsed time for a file copy command SteveInTallyFL Linux - Newbie 3 01-25-2010 01:08 PM
Get elapsed time HarryBoy Programming 2 08-08-2008 06:13 AM
diff. between elapsed time and cpu time madhugp Linux - General 1 01-15-2007 07:57 AM
find elapsed time innuendo_98 Programming 2 11-10-2005 08:03 AM
getting elapsed time.. Mad_C Programming 2 04-01-2003 01:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration