Re: Mail is not working (any way to send message when daemon is down)

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

 



On 09-Oct-2003/13:32 -0700, Dali Islam <ibmdali@xxxxxxxxx> wrote:
>the sendmail was corrupted after reloading the daemon
>it was fixed.
>
>Anyway, anyone knows how to send/relay a message only
>on the root login session when a service/daemon is
>down. Like in this case my sendmail was down. or is
>there a way that when root login, then it will see the
>message.

If root logs in at a console, add this to /root/.bash_login:

  service sendmail status

That will tell you the status every time root logs in. If you only want to
know if sendmail is not running, then use this:

  if ! service sendmail status > /dev/null; then
    echo sendmail is not running
  fi

You can deliver an email message to the local root account using procmail
(this is untested):


# Build the message in a temp file
tmpfile=/tmp/$0.$$
echo 'From: root@localhost' > $tmpfile
echo 'To: root@localhost' >> $tmpfile
echo -n 'Date: ' >> $tmpfile
date --rfc-822 >> $tmpfile
echo 'Subject: sendmail not running' >> $tmpfile
echo '' >> $tmpfile
service sendmail status >> $tmpfile

# Deliver the message and delete the temp file.
cat $tmpfile | procmail -d root
rm $tmpfile




Tony
-- 
Anthony E. Greene <mailto:Anthony%20E.%20Greene%20%3Cagreene@xxxxxxxxx%3E>
OpenPGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
AOL/Yahoo Messenger: TonyG05    HomePage: <http://www.pobox.com/~agreene/>
Linux. The choice of a GNU generation <http://www.linux.org/>


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux