From owner-freebsd-questions Sat Aug 19 4:27:27 2000 Delivered-To: freebsd-questions@freebsd.org Received: from snoopy.brwn.org (intgw1.brwn.org [196.28.127.66]) by hub.freebsd.org (Postfix) with ESMTP id 7648637B423; Sat, 19 Aug 2000 04:27:20 -0700 (PDT) Received: by snoopy.brwn.org (Postfix, from userid 1001) id 2D4D41D95; Sat, 19 Aug 2000 13:27:11 +0200 (SAST) Date: Sat, 19 Aug 2000 13:27:10 +0200 From: Willem Brown To: Ben Smithurst Cc: Nathan Vidican , questions@freebsd.org Subject: Re: /etc/crontab not work? Message-ID: <20000819132710.J52323@snoopy.brwn.org> References: <399A89CC.AA704AD6@wmptl.com> <20000817111319.B40744@snoopy.brwn.org> <20000819030319.B58928@strontium.scientia.demon.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <20000819030319.B58928@strontium.scientia.demon.co.uk>; from ben@FreeBSD.org on Sat, Aug 19, 2000 at 03:03:19AM +0100 X-Public-Key: http://willem.brwn.org/pubkey.txt X-Chat-Server: http://chat.brwn.org/ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, My apologies, I took what it said literally in the man page and did not think about that it uses the -c switch to execute the command. It did not even occur to me at the time, although I have noticed this on many occasions. I tried it just now and /bin/sh /bin/ls just outputs the following /bin/ls: 1: Syntax error: "(" unexpected whilst /bin/sh -c /bin/ls works as expected. Sorry for the misleading info. On Sat, Aug 19, 2000 at 03:03:19AM +0100, Ben Smithurst wrote: > 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 / Best Regards Willem Brown -- /* =============================================================== */ /* Linux, FreeBSD, NetBSD, OpenBSD. The choice is yours. */ /* =============================================================== */ Everyone gets away with something. No one gets away with everything. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message