![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to retrieve original contents of a modified file (modified using vi) | novice100 | UNIX for Dummies Questions & Answers | 3 | 05-31-2007 05:50 PM |
| who modified my file!! | mohanprabu | UNIX for Dummies Questions & Answers | 4 | 10-28-2005 07:18 PM |
| File last modified | szzz | High Level Programming | 4 | 11-05-2003 08:44 AM |
| How do I get the last modified date of a file? | akpopa | UNIX for Dummies Questions & Answers | 2 | 08-29-2001 12:08 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Check if file modified
Hi,
I have a monitoring script that I run, and I would like to automate checking if specific parameter file is modified during the last day or two. How do I do that? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Here is a very crude script(qualifies well for 'how not to write a script').
Learning phase for me Hopefully a much better solution would come up. Code:
#! /bin/sh
FILE=/file/to/check
DoC=echo `stat -c=%y $FILE | awk -F"-" '{ printf $3 }' | cut --delimiter=' ' -f1`
DoM=$((`date +%d` - DoC))
echo "$FILE last modified $DoM days ago"
DoM=Date of modification Not tested. Vino |
||||
| Google The UNIX and Linux Forums |