From owner-freebsd-questions@FreeBSD.ORG Tue Jun 12 05:05:42 2012 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 553751065673 for ; Tue, 12 Jun 2012 05:05:42 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (mx-out.r-bonomi.com [204.87.227.120]) by mx1.freebsd.org (Postfix) with ESMTP id 0BABD8FC0C for ; Tue, 12 Jun 2012 05:05:41 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.4/rdb1) id q5C56L2H026673; Tue, 12 Jun 2012 00:06:21 -0500 (CDT) Date: Tue, 12 Jun 2012 00:06:21 -0500 (CDT) From: Robert Bonomi Message-Id: <201206120506.q5C56L2H026673@mail.r-bonomi.com> To: freebsd-questions@freebsd.org, walterhurry@gmail.com In-Reply-To: Cc: Subject: Re: Newbie question: Why aren't my cron jobs running? 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: Tue, 12 Jun 2012 05:05:42 -0000 Walter Hurry wrote: > > As the subject says, this is probably a newbie question (I am new to > FreeBSD but quite experienced at Linux). > > FreeBSD9 on x86_64. > > Cron is running: > > $ ps -ax|grep cron > > 1513 ?? Is 0:00.01 /usr/sbin/cron -s > > 2283 0 S+ 0:00.00 grep cron > > $ > > I have a syntactically valid crontab: 'Syntactically valid', yes, but I believe "it does not mean what you think it does" applies. more below. > $ crontab -l > #min hr dom month dow command > > SHELL=/bin/bash > > PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/ > daddy/bin > > HOME=/home/walterh > > 00 02 * * * /home/walterh/exports.sh > > 05 02 * * * /home/walterh/backup_etc.sh > > 10 02 * * * /home/walterh/systemcheck.sh > > 15 02 * * * /home/walterh/backup_bsd.sh > > $ > > So what is wrong? Why is nothing happening? I have consulted the handbook > but see nothing. It _appears_ that there is whitespace _before_ the purporte 'minutes' value on each line that you intend to invoke a command. If so, -THAT- is probably what is causinng the unexpected behavior. I believe cron is looking for the 'minutes' value _before_ any white space, and using a value of '0' when it finds 'nothing' before the white-space Field-separator. That, thus, the all the commands run at 'zero minutes' past the various hours, on the -second- day of the month, and that command-line that cron would -attempt- to execute on the 2nd looks like, "* /home/walterh/systemcheck.sh", which, of course will have *wildly* unexpected results, epecially if the first element of the '*' expansion _is_ marked as executable. Remove the leading white-space and things should work the way you 'expect'. Comment: using a leading zero on the numeric fields is a BAD IDEA(tm) -- you are *strongly* encocuraged to remove them. Yes, that means numbers will not be column aligned, but it is a small price to pay to avoid the hair-tearing that =will= ensue when using it bites you.