Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 08 Jun 2007 18:55:58 +0200
From:      Sten Daniel Soersdal <netslists@gmail.com>
To:        Robin Becker <robin@reportlab.com>
Cc:        FreeBSD Questions <questions@freebsd.org>
Subject:   Re: detect stderr writes when combined
Message-ID:  <46698A1E.5050201@gmail.com>
In-Reply-To: <466952D9.2050903@chamonix.reportlab.co.uk>
References:  <466952D9.2050903@chamonix.reportlab.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
Robin Becker wrote:
> This is possibly a stupid question, but I would like to have a 
> particular sh script stdout and stderr combined, but at least detect 
> when stderr has been used.
> 
> In particular for my cron scripts it seems that error messages get 
> wrapped up and emailed, but they are then out of context with the normal 
> informative output. If I could have the combined output go to my logs in 
> the normal way and detect that some error output had occurred I could 
> then email the whole cron output.
> 
> I'm fairly sure this is doable with some C, but is there an easier way?

Perhaps using redirects?

this can be used in /bin/sh (and thus cron):

./myprogram 2>&1

where "myprogram" is your application.
this would combine stderr and stdout.

-- 
Sten Daniel Soersdal



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46698A1E.5050201>