Re: output from unnatended bash shell scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here is a very simple scirpt I wrote that checks for mail relaying
attempts against one of my mail servers, the output of the script is
piped to root and roots mail is directed to me via the aliases file.
The script is run daily by cron.
         
Hope this helps.

-jeff

-----start script-----

#!/usr/bin/perl -w

# Run this script daily to check
# for relaying attempts made against
# mail server and mail the results
# to root

use strict;

my $log = "/var/log/maillog";
system( "egrep -i denied $log |mail -s \"mail-relaying `date`\"root");         

-----end script------

* On [03-05-2004 12:56 -0800] Mark Shadley <mark@xxxxxxxxxx> wrote:
> Hi,
> 
> Thanks for the suggestion. I did that.
> 
> The problem is that the program output is not displayed in the emails
> *only* when run from cron. I get the emails, they are mostly empty.
> 
> Thanks again.
> 
> Mark Shadley
> 
> 
> On Fri, 5 Mar 2004, Matt Hemingway wrote:
> >
> > Try putting  MAILTO:user@xxxxxxxxxx  above the entry in the cron(tab) file.
> >
> > -Matt
> >
> > On Fri, 5 Mar 2004 12:47:44 -0800 (PST)
> > Mark Shadley <mark@xxxxxxxxxx> wrote:
> >
> > > Hi,
> > >
> > > I have forgotten how to get the output from unnatended bash shell scripts
> > > (run from crond) to show up in email. I get the emails, but they don't
> > > have all the output of the programs. If I run the scripts manually, I get
> > > all of the output in the emails.
> > >
> > > I appreciate any help offered.
> > >
> > > Thanks in advance.
> > >
> > > Mark Shadley
> > > -
> > > : send the line "unsubscribe linux-admin" in
> > > the body of a message to majordomo@xxxxxxxxxxxxxxx
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > >
> > -
> > : send the line "unsubscribe linux-admin" in
> > the body of a message to majordomo@xxxxxxxxxxxxxxx
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> 
-
: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux