Cronjob

Florian Lohoff flo at rfc822.org
Tue Nov 26 15:19:02 CET 2002


On Tue, Nov 26, 2002 at 09:26:06AM +0100, Ralph Meyer wrote:
> Hallo Liste,
> 
> wie kann ich mir von einem Cronjob
> nur die Standardfehlerausgabe als mail
> schicken lassen ?
> 
> 2> | mail ..
> 
> funktioniert nicht.

blahfasel 2>&1 >/dev/null | mailx -s "Test"

Problem - Du bekommst IMMER eine mail - Auch wenn du keine willst - Als
alternative so ein shell script nehmen:

-----------------------------------------------------
#!/bin/sh

t=`tempfile`

cat >${t}

if [ `wc -l ${t}` -gt 0 ]; then
	cat ${t} |\
		mailx $*
fi

rm -f ${t}
-----------------------------------------------------


Flo
-- 
Florian Lohoff                  flo at rfc822.org             +49-5201-669912
                        Heisenberg may have been here.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <http://lug-owl.de/pipermail/linux/attachments/20021126/ab55eaa1/attachment.sig>


More information about the Linux mailing list