invoking write from cron

Mike Spitzer mjs at mentor.cc.purdue.edu
Sat Apr 22 10:00:02 AEST 1989


In article <8594 at xanth.cs.odu.edu> kremer at cs.odu.edu (Lloyd Kremer) writes:
>In article <175 at dftsrv.gsfc.nasa.gov> tomc at dftsrv.gsfc.nasa.gov (Tom Corsetti)
>writes:
>
>>I'm trying to set up a script that runs from cron, checks files
>> ...
>>        echo "message to send" | write userid
>
>It works on our System V Release 3.  Write also issues a message to stderr
>reporting its inability to determine which terminal to use for replys, which
>cron mails to the crontab owner, but the message itself gets through OK.

Since Tom reported that it didn't work for him, I guess we can
assume that he not using System V Release 3.  4.3BSD write(1) exits
with a fatal error if it cannot find out what terminal the writer is
logged on to.  So, write isn't going to work under 4.3BSD if run from
inside cron.

It's relatively simple to write a shell script version of write using
echo, who, and awk that doesn't depend on a controlling tty.  You
might want to try that (or consider using logger(1)/syslog(8)
instead).

-- 
Michael J. Spitzer		Purdue University Computing Center
mjs at mentor.cc.purdue.edu	pur-ee!mentor.cc.purdue.edu!mjs



More information about the Comp.unix.wizards mailing list