On 09-Oct-2003/13:32 -0700, Dali Islam <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]' > $tmpfile
echo 'To: [EMAIL PROTECTED]' >> $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:[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to