Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site bgsuvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!cbosgd!osu-eddie!bgsuvax!schaefer From: schaefer@bgsuvax.UUCP (Stephen Schaefer) Newsgroups: net.unix-wizards,net.bugs.4bsd Subject: Cron won't run csh scripts Message-ID: <669@bgsuvax.UUCP> Date: Thu, 25-Jul-85 11:59:03 EDT Article-I.D.: bgsuvax.669 Posted: Thu Jul 25 11:59:03 1985 Date-Received: Sat, 27-Jul-85 03:12:09 EDT Organization: Bowling Green State University, OH Lines: 63 Xref: watmath net.unix-wizards:14015 net.bugs.4bsd:1625 We run 4.2BSD on a VAX 11/785, with source code licenses. Our csh scripts run correctly when run by root from a command shell, but do not run correctly when run by cron. Sh scripts *do* run correctly when run by cron. Csh scripts run from cron do nothing (so far) which produces side effects other than to be entered into the acct file as having been run by root and taken 0 seconds (according to lastcomm). I have tried many variations on the permissions, ownership and the manner of invocation, including cron lines like * * * * * /usr/local/test.csh * * * * * /bin/csh /usr/local/test.csh I've also tried redirecting the stdin and stdout on the invocation line to the console, in case csh demands those be attached to something (un?)reasonable, but no change, and I doubt that to be the problem. The test script which I've been using consists of #! /bin/csh echo 'set >> /tmp/sps1' > /tmp/sps1 set >> /tmp/sps1 echo >> /tmp/sps1 echo 'printenv >> /tmp/sps1' >> /tmp/sps1 printenv >> /tmp/sps1 So far, I've had to assume that the variables and environment variables are the default. I looked at the cron source, and it starts the process up with a line like execl("/bin/sh", "sh", "-c", s, 0); where s is a pointer to a string containing the invocation line, less the startup time symbols. I've gone so far as to try to start the script indirectly with an executable program like this Bourne shell script: exec /usr/local/test.csh or even this compiled C program: main() { execl("/usr/local/test.csh", "test.csh", 0); } In every case, it works correctly when run by root from a command shell (both csh and sh work) but not when initiated by cron. I'm now asking for help from the community. If there is sufficient interest, I will post the solution. I may be reached at: UUCP: ....!cbosgd!osu-eddie!bgsuvax!schaefer CSNET: schaefer@bgsuvax.CSNET Many thanks in advance, Stephen P. Schaefer P.S. I don't mind people MAILING me flames about csh, but let's not waste everyone's time with them? "If you are made to wait, it is only to serve you better." - quoted in "The Mythical Man Month" by F. P. Brooks.