From owner-freebsd-questions@FreeBSD.ORG Wed Jan 13 21:13:31 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7169F106568B for ; Wed, 13 Jan 2010 21:13:31 +0000 (UTC) (envelope-from listreader@lazlarlyricon.com) Received: from proxy2.bredband.net (proxy2.bredband.net [195.54.101.72]) by mx1.freebsd.org (Postfix) with ESMTP id 2A0988FC1E for ; Wed, 13 Jan 2010 21:13:30 +0000 (UTC) Received: from ipb2.telenor.se (195.54.127.165) by proxy2.bredband.net (7.3.140.3) id 4AD3E1BC025AD00C for freebsd-questions@freebsd.org; Wed, 13 Jan 2010 22:13:29 +0100 X-SMTPAUTH-B2: X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqVDAGbGTUtV44PPPGdsb2JhbACBRYZvkzgBAQEBN7s0hDAE X-IronPort-AV: E=Sophos;i="4.49,270,1262559600"; d="scan'208";a="26401379" Received: from c-cf83e355.09-42-6e6b7010.cust.bredbandsbolaget.se (HELO lazlar.kicks-ass.net) ([85.227.131.207]) by ipb2.telenor.se with ESMTP; 13 Jan 2010 22:13:29 +0100 Message-ID: <4B4E3778.1080609@lazlarlyricon.com> Date: Wed, 13 Jan 2010 22:13:28 +0100 From: Rolf Nielsen User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.5) Gecko/20091227 Thunderbird/3.0 MIME-Version: 1.0 To: Jeronimo Calvo References: <4B4E329D.4090806@lazlarlyricon.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD Questions Subject: Re: Crontab not working logwatch.pl [FreeBSD 8 stable] 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: Wed, 13 Jan 2010 21:13:31 -0000 On 2010-01-13 22:04, Jeronimo Calvo wrote: > did a crontab -r, a a new crontab -e, using: > > * * * * * $HOME/.profile ; /bin/bash /var/log/auto_auth.sh > * * * * * $HOME/.profile ; /usr/bin/perl /local/sbin/logwatch.pl > > tailing the /var/log/cron I can see that is being executed every > minute... but no emails arrived with is the proof that the script has > worked. > > > > 2010/1/13 Rolf Nielsen: >> On 2010-01-13 21:43, Jeronimo Calvo wrote: >>> >>> Hi folks, >>> >>> Im having probs when a root crontab located on /var/cron/tabs/root >>> >>> with this content >>> # DO NOT EDIT THIS FILE - edit the master and reinstall. >>> # (/tmp/crontab.DUtgfVoBT0 installed on Wed Jan 13 20:08:29 2010) >>> # (Cron version -- $FreeBSD: src/usr.sbin/cron/crontab/crontab.c,v >>> 1.31.2.1 2009/08/03 08:13:06 kensmith Exp $) >>> * * * * * ~/.profile ; /bin/bash /var/log/auto_auth.sh >>> * * * * * ~/.profile ; /usr/bin/perl /local/sbin/logwatch.pl >>> >>> both of them are sending logs to my email, when runned from the >>> command line works, but not from crontab >>> any ideas? >>> >> >> The keywords here are >> # DO NOT EDIT THIS FILE - edit the master and reinstall. >> >> Either edit the system crontab, /etc/crontab, or, to edit root's crontab, >> run crontab -e as root. >> > > > Please don't top post. Firstly, don't rely on environment variables being set correctly when running from cron. If you really want to use root's crontab, substitute /root for $HOME. Secondly, bash should be in /usr/local/bin, not in /bin. And it's a third party shell not included by the system. It has to be installed from ports. You should use /bin/sh instead. Thirdly, instead of putting the interpreter path on the command line, put it on the first line of your scripts, i.e. #!/bin/sh in the first one and #!/usr/bin/perl in the second one.