chuck wrote:
> 
> I do not know if this is exactly correct... I have SU in my
> /usr/sbin directory and I used the grep(mail) from Charles's site.
> 
> Per your goal below, I have a package for emailing your IP address
> also, its called mailip.lrp. it uses the same SU and MAIL as the package
> that emails logfiles.
> 
> Chuck
> 

Thanks go to both Chuck and and Brad.  Ok so now I am sending mail with
both the POSIXness mail command and through mailip.lrp provided by
Chuck. This is just at the DCD command prompt.  I haven't tried it with
multicron yet.

I am having trouble understanding the required use of su in the mail
scripts?  I even whacked it out of the mailip script and I still
received the ip address.  Is su required when you operate in a cron
environment?  If multicron is operating already in as root, what
advantage does su  provide other than issuing a command?  I am sure
there is something subtle I am missing or su was required at one time. 
If anyone has some ideas, please let me know.

My mini mail how to so far.  I have tried this on Dachstein CD.
The information may be useful on other LEAF firewalls:

1.) Use a Dachstien release. mail has been fixed via the grep command.
    Strange but true. You can find grep at 
    http://lrp.steinkuehler.net/Packages/Utilities.htm
    for earlier releases

2.) edit /etc/POSIXness.conf
    a.) uncomment both MAIL_SERVER and MAIL_DOMAIN.
    b.) MAIL_SERVER is set to your ISP's SMTP "outgoing" mail server
        you can find these in your ISP's instructions or look in
        your mail client's preferences.  For example Netscape is
        edit>preferences>Mail&Newsgroups>Mail Servers> then look in 
        the "Outgoing mail (SMTP) server:" box.
           MAIL_SERVER=smtp.myisp.com
    c.) If you are lucky set the MAIL_DOMAIN to the same SMTP
        server as MAIL_SERVER.  Otherwise, you will have to
        turn on your mail headers and look for a mail server
        that transferred mail to you.  It is helpful to email
        yourself a simple note so that you see the from mailer.
        Lucky setting is 
           MAIL_DOMAIN=smtp.myisp.com
        Mail header setting might be
           MAIL_DOMAIN=iFoundOne.smtp.myisp.com

3.) edit /etc/lrp.conf
    You will do this if you are going to uses Charles's mailonerr
    command.
    a.) uncomment both lrp_MAIL_SERVER and lrp_MAIL_ADMIN.
    b.) set lrp_MAIL_SERVER to the same as 2.c i.e.
        Lucky setting is 
           MAIL_DOMAIN=smtp.myisp.com
        Mail header setting might be
           MAIL_DOMAIN=iFoundOne.smtp.myisp.com
    c.) set lrp_MAIL_ADMIN to your email address.
           [EMAIL PROTECTED]

4.) Backup the etc.lrp package.  It contains the both the 
    POSIXness.conf file and the /etc/lrp.conf file.

5.) Use a command like the following at the command prompt to
    see if your configuration works.

    mail -s "test" [EMAIL PROTECTED] < /var/log/messages

    If you receive the following error,

       nc: smtp: Unknown host
       Error: Unknown response.
         RSET
         0:
       Aborting due to connection error
         Killing child processes: 28293 28296

    then perform steps two through five again until the error goes
    away.  You still do not have your ISP's SMTP mail servers
    correctly configured.  Practice on step two's configuration
    because that is all you need for the command line.  See the 
    following thread for useful help.
    http://sourceforge.net/mailarchive/message.php?msg_id=686539
    Remember that you are configuring a server here and that
    neither your email address or email password are required.

6.) See multicron issues here.  cron/multicron does not provide 
    a very large path variable setting.  You need to put in a
    path statement.
    Beginning of thread
     http://sourceforge.net/mailarchive/message.php?msg_id=686301
    An important branch
     http://sourceforge.net/mailarchive/message.php?msg_id=686302
    That takes you here
   
http://www.mail-archive.com/leaf-user%40lists.sourceforge.net/msg03040.html

7.) su is required for Charles Steinkuehler's mailonerror script.  
    Redhat puts the command in /bin.  Put it there if that is the 
    "correct" place. [EMAIL PROTECTED] had success with /usr/sbin.
    Backup root.lrp.


[EMAIL PROTECTED]'s script I wacked.  
Note my initials at the points of change, gpm.

#!/bin/sh
# file = mailip 4/26/02
# gpm su_user=root     Note this variable should be su_usr
su_usr=root # gpm

# gpm This was missing from Charles Steinkuehler's mailonerr command.
cmd="echo No command defined! && exit 1"

prefix=/tmp/$su_usr.$$

# gpm whack su's use.
# gpm   { su $su_usr -c "$cmd" 
# gpm   } 2>$prefix.err 1>$prefix.out
{
#
        echo "    ">>$prefix.msg
        echo "My IP address is :" >> $prefix.msg
        echo "    ">>$prefix.msg
        cat /tmp/myip >>$prefix.msg
#

} > $prefix.msg
#

# gpm  I replaced [EMAIL PROTECTED] with my email address.
   mail -s "Internet IP address" [EMAIL PROTECTED] < $prefix.msg
# add others if you like
# gpm I only needed one email address.
# gpm   mail -s "Internet IP address" [EMAIL PROTECTED] < $prefix.msg
#

rm $prefix*
#
# written by
# vette66 (chuck)
# http://www.vette66.com

I hope this helps,
Greg Morgan


> ----- Original Message -----
> From: "Greg Morgan" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; "chuck" <[EMAIL PROTECTED]>; "Dragon
> Wood" <[EMAIL PROTECTED]>
> Sent: Friday, May 17, 2002 3:32 PM
> Subject: Re: Re: [leaf-user] Is there a way to auto email log files
> 
> > "chuck" <[EMAIL PROTECTED]> wrote:
> > >
> > > I created a package to do just that...
> > > e-mail log files to a single or multiple addresses and
> > > you can specify which files to send.
> > > Its called mailstats.lrp and can be found at
> > > http://www.vette66.com
> > >
> > > It requires a working SU command and MAIL command.
> >
> > Is there a way to tell if you already have the working su and mail
> > commands already on your LEAF release? I see from
> > http://lrp.steinkuehler.net/Packages/Utilities.htm I can get su and grep
> > (mail) command for Dachstien. Dargon was asking about this on bering
> > rc2. From Charle's site is says that grep(mail) is in Dachstein
> > releases.  I looked all around in bin and sbin directories of my running
> > DCD 1.02.  I could not find su.  So I guess su is not included on the
> > CD. So do I
> >
> >    1.) put su in /bin?
> >    2.) edit /var/lib/lrpkg/root*list to add su?
> >    3.) backup root.lrp?
> >
> > I ask all these questions because I was unsuccessful using ipmail out of
> > KP Kirchdoerfer's modification to DCD 1.02 described at
> > http://leaf.sourceforge.net/article.php?op=Print&sid=30.  The release
> > notes suggested that there still is a problem with mail.
> >
> > Can anyone provides some more tips or links to mail configuration?
> >
> > My goal is to mail the dyanmaic ip address to another client.  The
> > client needs to ssh to backup files on a LEAF protected network.
> >
> > Thanks,
> > Greg Morgan
> >
> > > I expanded what was done by Charles and his mailonerr script.
> > > Hope this helps,
> > > vette66 (Chuck)
> > >
> > > ----- Original Message -----
> > > From: "Dragon Wood" <[EMAIL PROTECTED]>
> > <snip>
> >
> > > > I am using bering rc2. The /var/log directory gets
> > > > filled up quickly. How can I set it up such that the
> > > > files get automatically forwarded to an email address
> > > > and deleted when gets to a certain size?

_______________________________________________________________
Hundreds of nodes, one monster rendering program.
Now that's a super model! Visit http://clustering.foundries.sf.net/


------------------------------------------------------------------------
leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html

Reply via email to