Emailing output of tail -f
How would I be able to do something like this:
tail -f log | grep "I'm finished" | mail -s "It Is Finished" me@mine.com What I want is as soon as tail -f detects the string "I'm finished", to email me@mine.com the output of the "grepped" string (not the entire log) and return me to a command-prompt. Is that doable? |
check out this thread
http://www.linuxquestions.org/questi...d.php?t=438231 |
You could use process substitution:
Code:
#! /bin/bash |
hi i'm trying to do a tail of the processes under my system. I can't seem to get it to work. I have tried doing tail this way
tail -f|ps aux The processes display but it is static it's not updating the processes. I'm doing this just to understand the tail and Pipe commands, I might want to try redirecting the output to a text file too just for fun. Any thoughts guys? Thanks |
Quote:
tail to filter the output of your "ps" command, that gives you a list of processes? Assuming you mean the latter: ps -aux just lists some running processes once, not continuously, so you don't need tail's -f option. Also, I think you have the order of the commands reversed: Code:
ps -aux | tail And finally, try to start a new thread when you have a question, rather than hijacking someone else's, which is against the forum policy. |
All times are GMT -5. The time now is 01:57 AM. |