From owner-freebsd-questions@FreeBSD.ORG Tue Feb 24 10:17:32 2004 Return-Path: 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 4ACBB16A4CE for ; Tue, 24 Feb 2004 10:17:32 -0800 (PST) Received: from mxfep02.bredband.com (mxfep02.bredband.com [195.54.107.73]) by mx1.FreeBSD.org (Postfix) with ESMTP id B8FD043D2D for ; Tue, 24 Feb 2004 10:17:26 -0800 (PST) (envelope-from mathias@haas.se) Received: from haas.se ([213.114.148.49] [213.114.148.49]) by mxfep02.bredband.com with SMTP id <20040224181725.CFOZ5839.mxfep02.bredband.com@haas.se> for ; Tue, 24 Feb 2004 19:17:25 +0100 Received: (qmail 28020 invoked from network); 24 Feb 2004 18:22:38 -0000 Received: from mathias@haas.se by p3-550.haas.se by uid 82 with qmail-scanner-1.20 (spamassassin: 2.61. Clear:RC:1(192.168.10.10):. Processed: 22:38 -0000 Received: from unknown (HELO haas.se) (192.168.10.10) by: 22:38 -0000 Message-ID: <403B952C.4060706@haas.se> Date: Tue, 24 Feb 2004 19:17:16 +0100 From: Mathias Haas User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 Cc: freebsd-questions@freebsd.org References: <51804.193.14.163.194.1077641809.squirrel@mail.haas.se> <403B9112.1080503@circlesquared.com> <52540.192.168.0.97.1077646240.squirrel@webmail.thilelli.net> In-Reply-To: <52540.192.168.0.97.1077646240.squirrel@webmail.thilelli.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: Shell scripting woes. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: mathias@haas.se List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Feb 2004 18:17:32 -0000 Julien Gabel wrote: >>>Hello guys! I have two questions about shellscripts: >>>2) The same backup job - is written as a bash script, and it works >>>perfectly when run by hand, but it won't run as a cron job. >>> >>> >>Are you using a full path in the shebang at the top of the script? >>Such as: >> >>#!/bin/sh >>or >>#!/usr/local/bin/bash >> >> > >And more generally, is the ${PATH} variable set correctly according >to all the tools/utility used along your script? > > As a reply to both answers, here's a script that wont' run: #!/usr/local/bin/bash echo start > test.txt ...and here is bash: [root@p3-550 /usr/local/etc]>> whereis bash bash: /usr/local/bin/bash this is /var/log/cron Feb 24 19:20:00 p3-550 /usr/sbin/cron[27988]: (root) CMD (/usr/local/etc/test.sh) This is the crontab entry: * * * * * /usr/local/etc/test.sh (At the moment, I have no shell parameters or other parameters in crontab, another crontab-job runs fine, but that's an executable file.) /mathias