*BSD News Article 70908


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!inferno.mpx.com.au!news.unimelb.EDU.AU!munnari.OZ.AU!news.ecn.uoknor.edu!solace!nntp.uio.no!Norway.EU.net!EU.net!newsfeed.internetmci.com!in2.uu.net!minerva.ibernet.es!artemis.ibernet.es!usenet
From: Antonio Navarro Navarro <antonio@host.bemarnet.es>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Redirecting output of cron
Date: Thu, 13 Jun 1996 17:32:09 +0200
Organization: BemarNet Management
Lines: 32
Message-ID: <31C03479.B65@host.bemarnet.es>
References: <31bec05e.7376476@news.hq.af.mil>
NNTP-Posting-Host: ariadna.bemarnet.es
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.02b1 [es] (Win95; I)
To: Scott Gregory <sgregory@pubspo.hq.af.mil>

Scott Gregory wrote:
 
> Is it possible to have cron email the results of a script it ran sent
> to a list of users instead of root???
> 
> I have cron checking to see if a file had been dropped by a user.
> When it sees the file it runs a script to process the file.  When it
> finishes it dumps all the screen output from the script to a mail
> message to root.  Is there any way to have this output mailed to the
> uses that need to know if the script processed???

Well, you can make a shell script including a call to the sendmail program, providing the e-mail address of the 
user... Example : if the file checed is "/usr/file.checked" and the output screen is generated by the 'gen-out' 
program and this program shows the output in stdout, you can do the following :

#!/bin/sh

if [-f /usr/file.checked ]; then
  gen-out | sendmail user@host.domain
fi

Hope this helps. Regards.

+-----------------------------------------------------------------------+
| Antonio Navarro Navarro                 E-mail: webmaster@bemarnet.es |
+-----------------------------------------------------------------------+
| BemarNet Management                           Phone : +34-6-165.66.44 |
| Makes business easier...         \\\            Fax : +34-6-165.65.14 |
| http://www.bemarnet.es          (. .)                                 |
+------------------------------o00-(_)-00o------------------------------+
| Have a nice day - Have a nice day - Have a nice day - Have a nice day |
+-----------------------------------------------------------------------+