- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: What command to use to trap differences betwee...
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
10-10-2001 07:27 AM
10-10-2001 07:27 AM
What command to use to trap differences between two files?
I'm revising a script that among other things ensures that my /etc/inetd.conf isn't modified without my knowing it. The syntax I'm using now is:
diff file1 fileb | wc -w | awk '{print $1}'
if the output of that is greater than 0, I echo a message to sendmail which then notifies me of a change. WHAT I'D LIKE TO DO is to have the file comparison trap the difference and send THAT to sendmail so I could see exactly WHAT had changed. I've looked at diff, cmp, uniq and a few others but haven't (apparantly) seen what I need. Does someone have a suggestion on this?
Thanks,
Joe Robinson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2001 07:32 AM
10-10-2001 07:32 AM
Re: What command to use to trap differences between two files?
Why can't you send output of your diff file1 file2 output to email
Forexample
diff file1 file2 |wc -w |awk .....
if result=0 then exit
else diff file1 file2 |mailx -s
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2001 07:33 AM
10-10-2001 07:33 AM
Re: What command to use to trap differences between two files?
try sdiff -s file1 file2. Man sdiff for details.
Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2001 07:33 AM
10-10-2001 07:33 AM
Re: What command to use to trap differences between two files?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2001 07:53 AM
10-10-2001 07:53 AM
Re: What command to use to trap differences between two files?
diff file1 file2
if [ $? != 0 ]
then
sdiff -s file1 file2 |mailx -s "File 1 changed" your_id
fi
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2001 08:01 AM
10-10-2001 08:01 AM
Re: What command to use to trap differences between two files?
to be cautious about CPU time and such:
#!/usr/bin/sh
TMP=/tmp/diff.$$
MAIL=you@your.domain
file1=$1
file2=$2
trap "rm -f $TMP" 0
if diff $file1 $file2 > $TMP
then mailx -s"differences" $MAIL < $TMP
exit 1
fi
exit 0
# end
Just my ?0.02,
Wodisch