Article View: comp.sys.next.bugs
Article #52csh redirection fails when run under cron
From: Wade Blomgren
Date: Mon, 11 Jan 1993 21:21
Date: Mon, 11 Jan 1993 21:21
41 lines
2118 bytes
2118 bytes
After upgrading to 3.0 I am having a problem with csh scripts run from cron with user ids other than root. The scripts are run, but any redirection of output from a command WITHIN the script goes to the standard output of the script, not to the target of the redirection. For example, the following script (saved in, say, /tmp/script, mode 755): #! /bin/csh echo foo > /tmp/bar run by the following crontab entry: * * * * * me /tmp/script > /tmp/script.out 2>&1 results in the word "foo" appearing in /tmp/script.out, NOT /tmp/bar. The same is true for piped output: cat /etc/hosts | grep localhost > /tmp/bar will send the entire hosts file to the output of the script, and nothing goes through the grep or into /tmp/bar. NOTE: the output files _are created_. That is to say, in the first simple example, the file /tmp/bar will exist, but it will be empty. This behavior does not seem to happen when the cron command is run as root. When the script is run from the command line by the user account it works fine. Adding additional levels of indirection (script calling a script) seems to result in all output being lost. The problem does not occur on a self contained machine in my office but it does occur on our other machines. The only significant difference between my machine and the failing machines is the failing machines are running NIS. Can anyone else running non-root csh scripts with cron who is using NIS (or not) under 3.0 comment? Am I hallucinating? Thanks for any input - I will summarize responses. Wade Blomgren wade@hobbes.ucsd.edu
Technical Details
Message-ID:
<1isocbINNas7@network.ucsd.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!howland.reston.ans.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!rutgers!network.ucsd.edu!hobbes!wadeShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!howland.reston.ans.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!rutgers!network.ucsd.edu!hobbes!wade From: wade@hobbes.ucsd.edu (Wade Blomgren) Newsgroups: comp.sys.next.bugs,comp.sys.next.sysadmin Subject: csh redirection fails when run under cron Message-ID: <1isocbINNas7@network.ucsd.edu> Date: 11 Jan 93 21:21:15 GMT Followup-To: poster Organization: University of California, San Diego Lines: 41 NNTP-Posting-Host: hobbes.ucsd.edu