Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm having a small issue, i'm running and cron task every 5 minutes which is looking text chain and replacing it with nothing.. In order to optmize something i would like to add a new function to my cronstrask : send me an email if it replaces something.. if the crontask does not find the chain no need to send a mail. I have no idea how to do that , maybe you can help me . Here is my current cron task :

find /home -type f | xargs sed -i 's$chain if would like to era$ $g'
share|improve this question

closed as not a real question by Andrew, Jenny D, Ward, mdpc, Michael Hampton Apr 20 '13 at 6:34

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
Write a script. Call your script from Cron. –  Zoredache Apr 18 '13 at 22:33

1 Answer 1

By design, cron emails the output of any job to the MAILTO variable, or if that is not set, the owner of the job (e.g. root) is email. Call your script from cron and set the correct email alias, and you'll get mail if the script produces output.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.