Date: Tue, 12 Jun 2012 00:06:21 -0500 (CDT) From: Robert Bonomi <bonomi@mail.r-bonomi.com> To: freebsd-questions@freebsd.org, walterhurry@gmail.com Subject: Re: Newbie question: Why aren't my cron jobs running? Message-ID: <201206120506.q5C56L2H026673@mail.r-bonomi.com> In-Reply-To: <jr683k$gum$1@dough.gmane.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Walter Hurry <walterhurry@gmail.com> 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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206120506.q5C56L2H026673>