Date: Thu, 17 Aug 2000 11:13:20 +0200 From: Willem Brown <willem@brwn.org> To: Nathan Vidican <webmaster@wmptl.com> Cc: questions@freebsd.org Subject: Re: /etc/crontab not work? Message-ID: <20000817111319.B40744@snoopy.brwn.org> In-Reply-To: <399A89CC.AA704AD6@wmptl.com>; from webmaster@wmptl.com on Wed, Aug 16, 2000 at 08:32:12AM -0400 References: <399A89CC.AA704AD6@wmptl.com>
index | next in thread | previous in thread | raw e-mail
Hi,
On Wed, Aug 16, 2000 at 08:32:12AM -0400, Nathan Vidican wrote:
> I have two cron jobs which won't seem to run. If I run the exact same
> commands from a shell script, then everything goes well. There are no
> errors reported, nothing get's logged, yet nothing gets done either. The
> two entries in question are as follows:
>
> # run Perl script which backs up our databases
> # permissions set to 755, runs if user types: /etc/database-backup
> # must be run as root, should run nightly at or around 8:00pm
> 10 20 * * * root /etc/database-backup
> 2>&1 | sendmail garbage
What happens if you run it like this?
10 20 * * * root /usr/bin/perl /etc/database-backup 2>&1 | sendmail garbage
Cron uses /bin/sh to execute the script like this.
/bin/sh script
This will ignore whatever is on the first line the script, #!/usr/bin/perl,
and since it is not a valid bourne shell script it will most likely not work.
I based this on my interpretation of the following from the crontab(5) man
page, which means that I might be wrong.
The entire command portion of the line, up to a newline or % char-
acter, will be executed by /bin/sh or by the shell specified in the SHELL
variable of the cronfile.
>
> # run Perl script which backs up our databases
> # permissions set to 755, runs if user types: /etc/website-backup
> # must be run as root, should run Saturday nights at or around 8:30pm
> 30 20 * * 6 root /etc/website-backup 2>&1
> | sendm
> ail garbage
>
> If I create a shell script with the following:
>
> #!/bin/sh
>
> /etc/database-backup 2>&1 | sendmail garbage
> /etc/website-backup 2>&1 | sendmail garbage
>
> chmod 755 <script>
> Then run said script, and everything goes fine. I've tried restarting
> cron, but it still doesn't seem to do anything. Is there something
> obvious I'm missing here? Does /etc/crontab not work? Should I usr
> /var/cron/tabs/root instead?
>
> --
> Nathan Vidican
> webmaster@wmptl.com
> Windsor Match Plate & Tool Ltd.
> http://www.wmptl.com/
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
>
Best Regards
Willem Brown
--
/* =============================================================== */
/* Linux, FreeBSD, NetBSD, OpenBSD. The choice is yours. */
/* =============================================================== */
Everything takes longer than you expect.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000817111319.B40744>
