- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- comparing file date to system date
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2006 10:49 AM
01-09-2006 10:49 AM
comparing file date to system date
Thanks,
Staci
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2006 11:43 AM
01-09-2006 11:43 AM
Re: comparing file date to system date
One approach is as follows:
# touch -amt `date +%m%d`0000 /tmp/myref
# [ yourfile -nt /tmp/myref ] || mailx -s "yourfile not updated!" root < /dev/null
This creates a reference file whose modification timestamp is today at 00:00 hours. If 'yourfile' is *not* newer than that reference time, an email is generated to 'root' informing you of the condition.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2006 11:48 AM
01-09-2006 11:48 AM
Re: comparing file date to system date
if [[ `ll ${FILENAME} |awk '{ print$6,$7 }'` = `date +%b%e` ]]
then
# the dates match...
else
# the dates don't match, send email...
fi
( not sure how well this will work in all different circomstances)
- John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2006 11:50 AM
01-09-2006 11:50 AM
Re: comparing file date to system date
if [[ `ll ${FILENAME} |awk '{ print$6,$7 }'` = `date +%b%e` ]]
then
# the dates match...
else
# the dates don't match, send email...
fi
( not sure how well this will work in all different circumstances)
- John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2006 02:26 PM
01-09-2006 02:26 PM
Re: comparing file date to system date
#!/bin/ksh
file=/etc/testfile
if [[ "$(ls -l $file | awk '{ print $7,$8 }')" = "$(date +'%d %H:%M')" ]]
then
echo "File is updated" | mail mailid
else
echo "File is not updated" | mail mailid
fi
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2006 06:47 AM
01-16-2006 06:47 AM