🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.sysadmin
Article #2251

Re: cron and shell scripts

#2251
From: Wade Blomgren
Date: Thu, 07 Jan 1993 19:01
44 lines
2165 bytes
In an article, mikael@scout.utexas.edu (Mikael Behrens) writes:
|> 
|> [description of failure of cron entry for user other than root]

After upgrading to 3.0 I am having a related problem, with non-root
csh scripts run from cron.  The scripts are run, but any redirection
of output from a command in 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 by
root.  When the script is run from the command line by the user account
it works fine. 

The problem does not occur on a self contained machine in my office but
it does occur on our other machines.  As I type this I realize the main
difference between my machine and the failing machines is the failing
machines are running NIS.  I'm going to turn NIS off on one of the
machines and see if the problem goes away.  In the meantime, can anyone
else who is using NIS (or not) under 3.0 comment?  Am I hallucinating?

Wade Blomgren
wade@hobbes.ucsd.edu
Technical Details
Message-ID: <1ihumsINN1mq@network.ucsd.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!paladin.american.edu!gatech!swrinde!network.ucsd.edu!hobbes!wade
References: <86258@ut-emx.uucp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!paladin.american.edu!gatech!swrinde!network.ucsd.edu!hobbes!wade
From: wade@hobbes.ucsd.edu (Wade Blomgren)
Newsgroups: comp.sys.next.sysadmin
Subject: Re: cron and shell scripts
Date: 7 Jan 1993 19:01:48 GMT
Organization: UC San Diego Academic Computing
Lines: 44
Distribution: usa
Message-ID: <1ihumsINN1mq@network.ucsd.edu>
References: <86258@ut-emx.uucp>
NNTP-Posting-Host: hobbes.ucsd.edu
Summary: csh under cron, strange failures