HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script - for change files other than *.log,*.o...
Operating System - HP-UX
1832645
Members
3072
Online
110043
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
09-19-2006 03:23 AM
09-19-2006 03:23 AM
Hi
I need a script to log all the files that have changed in last one day excluding the *.log,*.out,*.tmp files .
I would like the changed files sent to a log file, and have the days changed files emailed.
so, for example, if 5 files change everyday, then only the 5 files of that day will be emailed, BUT, all of the previous files will be retained in the log file....i want to use the log file as an archive, and the email as a notification.
TIA
I need a script to log all the files that have changed in last one day excluding the *.log,*.out,*.tmp files .
I would like the changed files sent to a log file, and have the days changed files emailed.
so, for example, if 5 files change everyday, then only the 5 files of that day will be emailed, BUT, all of the previous files will be retained in the log file....i want to use the log file as an archive, and the email as a notification.
TIA
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2006 03:28 AM
09-19-2006 03:28 AM
Solution
Hey
find ${dir} -mtime -1 -print | egrep -v "\.tmp|\.out|\.log" | \
tee -a ${log} | mailx -s "File changes: `date +%m/%d/%y`" ${addr}
Hope that helps.
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
find ${dir} -mtime -1 -print | egrep -v "\.tmp|\.out|\.log" | \
tee -a ${log} | mailx -s "File changes: `date +%m/%d/%y`" ${addr}
Hope that helps.
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2006 03:52 AM
09-19-2006 03:52 AM
Re: Script - for change files other than *.log,*.out,*.tmp
Hi,
the find command can get the files by itself:
find . -mtime -1 ! \(-name '*.log' -o -name '*.out' -o -name '*.tmp' \) -print |
tee -a log |
mailx -s "File changes $(date +%x)" mailaddr
mfG Peter
the find command can get the files by itself:
find . -mtime -1 ! \(-name '*.log' -o -name '*.out' -o -name '*.tmp' \) -print |
tee -a log |
mailx -s "File changes $(date +%x)" mailaddr
mfG Peter
The Universe is a pretty big place,
it's bigger than anything anyone has ever dreamed of before.
So if it's just us, seems like an awful waste of space, right?
Jodie Foster in "Contact"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2006 04:25 AM
09-21-2006 04:25 AM
Re: Script - for change files other than *.log,*.out,*.tmp
Hi,
on my hp-ux 11i the rigth syntax is:
find . -type f -mtime 0 ! \( -name '*.log' -o -name '*.out' -o -name '*.tmp' \) |xargs -i ll {}|tee -a logfile |mailx -s subject ajondoe@hotmnail.com
Tips:
-type f: to get only file chnages and not dir or file in subdirs
-mtime 0: to have file chnages from 24 hours ago to now as from man:
-mtime n True if the file modification time subtracted
from the initialization time is n-1 to n
multiples of 24 h. The initialization time
shall be a time between the invocation of the
find utility and the first access by that
invocation of the find utility to any file
specified in its path operands.
xargs -i ll {}: to chek about file date
HTH,
Art
on my hp-ux 11i the rigth syntax is:
find . -type f -mtime 0 ! \( -name '*.log' -o -name '*.out' -o -name '*.tmp' \) |xargs -i ll {}|tee -a logfile |mailx -s subject ajondoe@hotmnail.com
Tips:
-type f: to get only file chnages and not dir or file in subdirs
-mtime 0: to have file chnages from 24 hours ago to now as from man:
-mtime n True if the file modification time subtracted
from the initialization time is n-1 to n
multiples of 24 h. The initialization time
shall be a time between the invocation of the
find utility and the first access by that
invocation of the find utility to any file
specified in its path operands.
xargs -i ll {}: to chek about file date
HTH,
Art
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP