Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Aug 2000 03:03:19 +0100
From:      Ben Smithurst <ben@FreeBSD.org>
To:        Willem Brown <willem@brwn.org>
Cc:        Nathan Vidican <webmaster@wmptl.com>, questions@freebsd.org
Subject:   Re: /etc/crontab not work?
Message-ID:  <20000819030319.B58928@strontium.scientia.demon.co.uk>
In-Reply-To: <20000817111319.B40744@snoopy.brwn.org>
References:  <399A89CC.AA704AD6@wmptl.com> <20000817111319.B40744@snoopy.brwn.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Willem Brown wrote:

> Cron uses /bin/sh to execute the script like this.
> 
> /bin/sh script

If it did that, it would have real trouble with a cron command like

*	*	*	*	*	/bin/ls

Try "/bin/sh /bin/ls" at a prompt and see what happens (don't really,
take it from me that you'll likely get garbage on your screen or a
syntax error with some weird error message).  It uses "/bin/sh -c
whatever-command-is-there", so that /bin/sh will just call exec() on
the perl script, which will work because of the #! line.  Assuming the
execute bit is set, which it must be if the command works on the command
line.  If the execute bit wasn't set, then explicitly invoking perl
would fix it.  If your suggest does fix it, and the execute bit is set,
then I don't know what's going on.  Since Nathan says there's no output
or errors or anything logged, I'm rather confused anyway.

> 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.

Just a slight misunderstanding, I think. /bin/sh is used, but not in the
way you suggest.

-- 
Ben Smithurst                 / ben@FreeBSD.org / PGP: 0x99392F7D
FreeBSD Documentation Project /


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000819030319.B58928>