Date: Sat, 19 Aug 2000 13:27:10 +0200 From: Willem Brown <willem@brwn.org> To: Ben Smithurst <ben@FreeBSD.org> Cc: Nathan Vidican <webmaster@wmptl.com>, questions@freebsd.org Subject: Re: /etc/crontab not work? Message-ID: <20000819132710.J52323@snoopy.brwn.org> In-Reply-To: <20000819030319.B58928@strontium.scientia.demon.co.uk>; from ben@FreeBSD.org on Sat, Aug 19, 2000 at 03:03:19AM %2B0100 References: <399A89CC.AA704AD6@wmptl.com> <20000817111319.B40744@snoopy.brwn.org> <20000819030319.B58928@strontium.scientia.demon.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000819132710.J52323>