home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / next / bugs / 44 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  2.1 KB

  1. Xref: sparky comp.sys.next.bugs:44 comp.sys.next.sysadmin:7386
  2. Path: 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
  3. From: wade@hobbes.ucsd.edu (Wade Blomgren)
  4. Newsgroups: comp.sys.next.bugs,comp.sys.next.sysadmin
  5. Subject: csh redirection fails when run under cron
  6. Message-ID: <1isocbINNas7@network.ucsd.edu>
  7. Date: 11 Jan 93 21:21:15 GMT
  8. Followup-To: poster
  9. Organization: University of California, San Diego
  10. Lines: 41
  11. NNTP-Posting-Host: hobbes.ucsd.edu
  12.  
  13. After upgrading to 3.0 I am having a problem with csh scripts run from cron 
  14. with user ids other than root.  The scripts are run, but any redirection
  15. of output from a command WITHIN the script goes to the standard output
  16. of the script, not to the target of the redirection.
  17.  
  18. For example, the following script (saved in, say, /tmp/script, mode 755):
  19.  
  20. #! /bin/csh
  21. echo foo > /tmp/bar
  22.  
  23. run by the following crontab entry:
  24.  
  25. * * * * * me /tmp/script > /tmp/script.out 2>&1
  26.  
  27. results in the word "foo" appearing in /tmp/script.out, NOT /tmp/bar.
  28.  
  29. The same is true for piped output:
  30.  
  31. cat /etc/hosts | grep localhost > /tmp/bar
  32.  
  33. will send the entire hosts file to the output of the script, and nothing
  34. goes through the grep or into /tmp/bar.
  35.  
  36. NOTE: the output files _are created_.  That is to say, in the first
  37. simple example, the file /tmp/bar will exist, but it will be empty.
  38.  
  39. This behavior does not seem to happen when the cron command is run as
  40. root.  When the script is run from the command line by the user account
  41. it works fine.   Adding additional levels of indirection (script calling
  42. a script) seems to result in all output being lost.
  43.  
  44. The problem does not occur on a self contained machine in my office but
  45. it does occur on our other machines.  The only significant difference 
  46. between my machine and the failing machines is the failing machines are 
  47. running NIS.  Can anyone else running non-root csh scripts with cron who 
  48. is using NIS (or not) under 3.0 comment?  Am I hallucinating?
  49.  
  50. Thanks for any input - I will summarize responses.
  51.  
  52. Wade Blomgren
  53. wade@hobbes.ucsd.edu
  54.