(Moved to misc@, since it's becoming slightly offtopic on tech@) On Fri, May 05, 2006 at 12:16:42AM +0200, vetinari wrote: > > > > > */5 * * * * root /path/../script.sh | mail -e root > > > > > > > > > > where script.sh most of the time outputs nothing.
cron(8) does this out of the box. > > > > > */5 * * * * root /path/../script.sh | grep . && mail -e root [...] > > Actually, my workaround is complete bogus. cat will not get the output > > from grep. And here I've to apologize for my reply yesterday, since I only recognized that "grep . removes empty lines" (and yet have been fooled by that attempt to execute some command only if it's input is not empty). > How should I do it then? For cron: just put your command into the crontab(5). For everything else, use something like this (additional shielding for the first line starting with a `-' may be needed): $ script.sh | { read l && { echo "$l"; cat; } | mail -s foo root; } Ciao, Kili