From owner-freebsd-questions@FreeBSD.ORG Fri Jun 8 17:26:07 2007 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2117416A421 for ; Fri, 8 Jun 2007 17:26:07 +0000 (UTC) (envelope-from netslists@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.168]) by mx1.freebsd.org (Postfix) with ESMTP id 897F113C487 for ; Fri, 8 Jun 2007 17:26:06 +0000 (UTC) (envelope-from netslists@gmail.com) Received: by ug-out-1314.google.com with SMTP id u2so1143527uge for ; Fri, 08 Jun 2007 10:26:05 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; b=TAz2ESaJowD3VasShx+WjNt4n46sgww5PtK9pAauYDvfrzExkAo2hQrVb+B07NZROKU6+iouHUaqfW+ypCAst8VRz9dePcum8hXFtYWKg7edguGgd3l+IaCn8s4MPYwAqqEWqR1Xyy80uMfhvwZh1oBPn74cDramoDBcciFk3ns= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; b=J4/+3UEe4oAG/lcXIYaSRE8uBPytJwllANFKQOvI8v3pusEKzFPnPzP5+jJS7I8eIZLpg/JPYIWaX9uwztcI3lH4tsBagQvUJviL2AOTiMBC+V5rdg59TDhD3U/bReg7QO+AGlzebB0vpdMCxM41AMBVcWFObdSOZuaXpV6SFes= Received: by 10.82.105.13 with SMTP id d13mr5747499buc.1181321765644; Fri, 08 Jun 2007 09:56:05 -0700 (PDT) Received: from ?192.168.9.26? ( [91.135.49.10]) by mx.google.com with ESMTP id d26sm521628nfh.2007.06.08.09.56.03 (version=SSLv3 cipher=RC4-MD5); Fri, 08 Jun 2007 09:56:04 -0700 (PDT) Message-ID: <46698A1E.5050201@gmail.com> Date: Fri, 08 Jun 2007 18:55:58 +0200 From: Sten Daniel Soersdal User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 To: Robin Becker References: <466952D9.2050903@chamonix.reportlab.co.uk> In-Reply-To: <466952D9.2050903@chamonix.reportlab.co.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD Questions Subject: Re: detect stderr writes when combined X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2007 17:26:07 -0000 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