- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- conditional mail on find?
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
03-26-2003 02:05 PM
03-26-2003 02:05 PM
I tried this but it always sends a message, which isn't what I want.
find / \( -name myLog.out' \) -size +1c -exec cat {} \; | mail user@domain
Is what I'm attempting even possible without having to create a script?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2003 02:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2003 02:46 PM
03-26-2003 02:46 PM
Re: conditional mail on find?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2003 02:55 PM
03-26-2003 02:55 PM
Re: conditional mail on find?
You will need to change my example to fit your needs (of course). That is, I offered a working "script" that probes the /tmp directory for a file named "myLog.out" with a size of zero bytes -- quite convenient for testing the logic...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2003 04:13 PM
03-26-2003 04:13 PM
Re: conditional mail on find?
Your example does the same as mine -- always sending a file. I want the mail to be conditional. Nice try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2003 04:17 PM
03-26-2003 04:17 PM
Re: conditional mail on find?
Yes, thanks. Did modify your example for my needs. In fact, wanted the contents of the log sent to me, so here is what I did --
find / \( -name 'myLog.out' -a -size +0c \) |[ `wc -c` != 0 ] && mail user@domain < myLog.out
For extra points, how to set find statement to a variable and then reuse variable for redirecting to mail?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2003 05:17 PM
03-26-2003 05:17 PM
Re: conditional mail on find?
By example, consider this:
# DIR=/tmp
# NAME=myLog.out
# SIZE=500
# find ${DIR} \( -name ${NAME} -a -size +${SIZE}c \)
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2003 08:55 PM
03-26-2003 08:55 PM
Re: conditional mail on find?
i usually do it this way:
#=============================
#!/bin/sh
emailadd1=yogeeraj@mymailserver.mu
DIR=/tmp
NAME=105.sh
SIZE=5
m=`find ${DIR} \( -name ${NAME} -a -size +${SIZE}c \)`
/usr/bin/uuencode $m "logfile_needed.log"|mailx -m -s "The is the file you need - `date`" $emailadd1
#=============================
Hope this helps!
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2003 02:27 PM
03-27-2003 02:27 PM
Re: conditional mail on find?
Thanks again for the example. This is what I ended up with (all on one line) --
# FPATH=/path/to; FNAME=myLog.out; find ${FPATH} \( -name ${FNAME} -a -size +0c \) |[ `wc -c` != 0 ] && > mail user@domain < "${FPATH}/${FNAME}"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2003 02:30 PM
03-27-2003 02:30 PM
Re: conditional mail on find?
Thanks for your example. Didn't try it out because I ended up doing this --
# FPATH=/path/to; FNAME=myLog.out; find ${FPATH} \( -name ${FNAME} -a -size +0c \) |[ `wc -c` != 0 ] && > mail user@domain < "${FPATH}/${FNAME}"