Register
It is currently Fri Apr 18, 2014 11:02 pm

script to search and email if results is found


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Fri Jul 22, 2011 8:16 am   

Joined: Tue Dec 11, 2007 10:21 pm
Posts: 20
Hello i need a script like

mycommand file |grep OK
if grep=Ok
then mail OK
else
have a nice day

something like that , i need a script to get the results from a command if command say ok then to email me the ok results

any ideea , i'am still searching and i cannot find it anywhere.


Top
 Profile  
 PostPosted: Fri Jul 22, 2011 2:05 pm   
User avatar

Joined: Tue Apr 27, 2010 2:28 pm
Posts: 172
Location: Czech Republic
Untested:
Code:
mycommand file | grep OK > tempfile
[[ -s tempfile ]] && mail username@address.com < tempfile
rm tempfile


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP