From owner-freebsd-questions@FreeBSD.ORG Fri Feb 17 23:56:29 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7C3B116A420 for ; Fri, 17 Feb 2006 23:56:29 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id DA5C143D46 for ; Fri, 17 Feb 2006 23:56:28 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.4) id k1HNuRRL024008; Fri, 17 Feb 2006 17:56:27 -0600 (CST) (envelope-from dan) Date: Fri, 17 Feb 2006 17:56:27 -0600 From: Dan Nelson To: Tim Daneliuk Message-ID: <20060217235627.GF52817@dan.emsphone.com> References: <43F50074.8060205@tundraware.com> <20060217011923.GA87403@dan.emsphone.com> <43F65EC4.8000703@tundraware.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43F65EC4.8000703@tundraware.com> X-OS: FreeBSD 5.4-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.11 Cc: freebsd-questions@freebsd.org Subject: Re: /bin/sh Madness 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, 17 Feb 2006 23:56:29 -0000 In the last episode (Feb 17), Tim Daneliuk said: > Dan Nelson wrote: > >Could your $3 command be returning a nonzero exit code? You probably > >want something more like > > > >touch $2/.$1-begin && { eval $3 2>&1 >> $log ; touch $2/.$1-end } & > > > >so your end timestamp always gets created whether or not $3 succeeds. > >Also note that in your original script, you only backgrounded "touch > >$2/.$1-end", which is probably not what you wanted. > > This seems not to work - I don't think 'sh' likes nested function > braces - recall that this command appears inside a shell function. Oops. Braces aren't bourne syntax, and in this case they're the wrong choice anyway. parens (i.e. a subshell) are what's needed. touch $2/.$1-begin && ( eval $3 2>&1 >> $log ; touch $2/.$1-end ) & I actually tested this one :) > In any case, I think I have nailed the problem. It seems that the > external script being called made reference to 'chown' without explicitly > naming the program's path. Under 'cron' control, there is no path to > /usr/sbin by default so the script was exiting with a non-zero exit > status as several here suggested. red face>. > > Many thanks to all who took time to answer. -- Dan Nelson dnelson@allantgroup.com