Unix Technical Forum

sendmail replacement script

This is a discussion on sendmail replacement script within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> On Tue, 19 Sep 2006 18:37:17 +0000, Sylvain Robitaille wrote: > Ok, then you likely only need to know ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-20-2008, 07:02 PM
Mike Denhoff
 
Posts: n/a
Default sendmail replacement script

On Tue, 19 Sep 2006 18:37:17 +0000, Sylvain Robitaille wrote:

> Ok, then you likely only need to know that Sendmail doesn't need to
> be reachable from the network to do local delivery. In fact you
> probably should have a mail daemon running (at least locally) so you can
> receive any output from other cronjobs (for example if any of them
> fail).
>

I don't want to install sendmail, but I still want to see messages from
cron. I wrote the following script

#!/bin/bash
# MD 30 Jan 06
# to replace sendmail mv this to /usr/sbin/sendmail
cat >> /home/mike/fromSendmail.txt
echo $( date ) >> /home/mike/fromSendmail.txt
echo $@ >> /home/mike/fromSendmail.txt
exit 0

When cron sends an email it just gets appended to the file
/home/mike/fromSendmail.txt. I could instead have the script send an
email using nail with a line something like


cat | /usr/bin/nail -s "cron message $(date)" \
-r mike@address denhoff@mail.server


Mike
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-20-2008, 07:02 PM
Grant
 
Posts: n/a
Default Re: sendmail replacement script

On Wed, 20 Sep 2006 17:28:39 -0400, Mike Denhoff <mike@invalid.invalid> wrote:

>I don't want to install sendmail, but I still want to see messages from
>cron. I wrote the following script


I'm happy appending to a log file, but there's only one box running 24/7
to worry about here I'm thinking Sylvain wants mail 'cos too many
boxen to log in to just check if okay.

Grant.
--
http://bugsplatter.mine.nu/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-20-2008, 07:02 PM
Sylvain Robitaille
 
Posts: n/a
Default Re: sendmail replacement script

Grant wrote:

> I'm thinking Sylvain wants mail 'cos too many boxen to log in to
> just check if okay.


Yes, especially at work, but at home too. Sysadmins are lazy by nature.
More than one system is "too many" to log into daily, so reports are
generated daily and sent via email instead. If the email doesn't
arrive, I already know there's a problem. :-)

I would likely do the same with only one system, if it were connected
to the Internet, though. I don't want to read system logs daily (access
logs, for example), so I prefer to have a script that reads them for me,
and summarizes them to me instead.

--
----------------------------------------------------------------------
Sylvain Robitaille syl@alcor.concordia.ca

Systems and Network analyst Concordia University
Instructional & Information Technology Montreal, Quebec, Canada
----------------------------------------------------------------------
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-20-2008, 07:02 PM
Mikhail Zotov
 
Posts: n/a
Default Re: sendmail replacement script

On Thu, 21 Sep 2006 02:57:15 +0000 (UTC)
Sylvain Robitaille <syl@alcor.concordia.ca> wrote:
> I would likely do the same with only one system, if it were connected
> to the Internet, though. I don't want to read system logs daily (access
> logs, for example), so I prefer to have a script that reads them for me,
> and summarizes them to me instead.


Sylvain, is it possible to have a look at the script?

The reason for my question is that I am not fully satisfied with log
monitoring tools I have tried thus far. This made me write a simple
bash script of my own, employing a couple of awk filters written
by Grant Coady: <http://bugsplatter.mine.nu/awk/>. The script of mine
is really trivial thus it would be interesting to study a script of
an IT professional.

Regards,
Mikhail
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-20-2008, 07:02 PM
Mikhail Zotov
 
Posts: n/a
Default Re: sendmail replacement script

On Wed, 20 Sep 2006 17:28:39 -0400
Mike Denhoff <mike@invalid.invalid> wrote:
> I don't want to install sendmail, but I still want to see messages from
> cron.

....
> I could instead have the script send an
> email using nail with a line something like
>
>
> cat | /usr/bin/nail -s "cron message $(date)" \
> -r mike@address denhoff@mail.server


Does this really work for you? For me, this doesn't work unless
sendmail daemon is running.

Mikhail
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-20-2008, 07:02 PM
Sylvain Robitaille
 
Posts: n/a
Default Re: sendmail replacement script

Mikhail Zotov wrote:

>> I don't want to read system logs daily (access logs, for example), so
>> I prefer to have a script that reads them for me, and summarizes them
>> to me instead.

>
> Sylvain, is it possible to have a look at the script?


Certainly. That particular script can be found on
http://www.therockgarden.ca/software/
It's the "authstats" script.

> ... it would be interesting to study a script of an IT professional.


Yikes! I don't promise that my script will live up to any sort of
progamming expectations you might have! Very often, of course, simpler
is better. You might not find this is an improvement over what you've
done. It was written for a specific environment, though I'm fairly
certain that it can reasonably be useful for others as well. Please be
sure to read the included README file, as that contains some important
information regarding what likely needs to be configured for this to run
on your system.

Enjoy!

--
----------------------------------------------------------------------
Sylvain Robitaille syl@alcor.concordia.ca

Systems and Network analyst Concordia University
Instructional & Information Technology Montreal, Quebec, Canada
----------------------------------------------------------------------
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-20-2008, 07:02 PM
Mike Denhoff
 
Posts: n/a
Default Re: sendmail replacement script

On Thu, 21 Sep 2006 10:05:24 +0400, Mikhail Zotov wrote:

> On Wed, 20 Sep 2006 17:28:39 -0400
> Mike Denhoff <mike@invalid.invalid> wrote:
>> I don't want to install sendmail, but I still want to see messages from
>> cron.

> ...
>> I could instead have the script send an
>> email using nail with a line something like
>>
>>
>> cat | /usr/bin/nail -s "cron message $(date)" \
>> -r mike@address denhoff@mail.server

>
> Does this really work for you? For me, this doesn't work unless
> sendmail daemon is running.
>

Yes, it works for me, but one has to tell nail to use a mail server. I
put a file in my home directory named ".mailrc" containing

set smtp=mail.server

Alternatively, this line could be added to /etc/nail.rc
See "man nail" and search for "smpt".

Mike

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-20-2008, 07:02 PM
Mikhail Zotov
 
Posts: n/a
Default Re: sendmail replacement script

On Thu, 21 Sep 2006 13:23:55 -0400
Mike Denhoff <mike@invalid.invalid> wrote:

> On Thu, 21 Sep 2006 10:05:24 +0400, Mikhail Zotov wrote:
> >> cat | /usr/bin/nail -s "cron message $(date)" \
> >> -r mike@address denhoff@mail.server

> >
> > Does this really work for you? For me, this doesn't work unless
> > sendmail daemon is running.
> >

> Yes, it works for me, but one has to tell nail to use a mail server. I
> put a file in my home directory named ".mailrc" containing
>
> set smtp=mail.server
>
> Alternatively, this line could be added to /etc/nail.rc
> See "man nail" and search for "smpt".


Thank you for the reply, Mike. I see my mistake: I tried to use nail
for _local_ delivery this way.

--
Mikhail

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-20-2008, 07:02 PM
Mikhail Zotov
 
Posts: n/a
Default Re: sendmail replacement script

On Thu, 21 Sep 2006 15:21:11 +0000 (UTC)
Sylvain Robitaille <syl@alcor.concordia.ca> wrote:

> Mikhail Zotov wrote:
>
> > Sylvain, is it possible to have a look at the script?

>
> Certainly. That particular script can be found on
> http://www.therockgarden.ca/software/
> It's the "authstats" script.

....
>
> Enjoy!


Thanks, Sylvain! Actually, I have found much more than I expected :-)

--
Mikhail
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-20-2008, 07:02 PM
Grant
 
Posts: n/a
Default Re: sendmail replacement script

On Thu, 21 Sep 2006 15:21:11 +0000 (UTC), Sylvain Robitaille <syl@alcor.concordia.ca> wrote:

>http://www.therockgarden.ca/software/


s/covert/convert/ on that page

Grant.
--
http://bugsplatter.mine.nu/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:38 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com