Cron won't run csh scripts
Stephen Schaefer
schaefer at bgsuvax.UUCP
Fri Jul 26 01:59:03 AEST 1985
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 at 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.
More information about the Comp.unix.wizards
mailing list