1847893 Members
3255 Online
104021 Solutions
New Discussion

Re: email

 
kumaresan_1
Occasional Advisor

email

Hi All,

When ever my m/c down and rebooted because of panic or normal shutdown . i have get the email notice .. like shutdownlog ..
For this i have put entry in cron or someother way is
their?
Thankx
bye

kumaresan
5 REPLIES 5
Michael Tully
Honored Contributor

Re: email

Your problem is you don't know when your system goes down, so it is a little difficult to place a cron entry for this.
The best way is to monitor your system remotely is from a different server. You could write a small script to do this.
If you wanted to find out information like this, you could place a script in the system startup area (/sbin/init.d) that e-mails the last line of the /etc/shutdownlog.

'tail -1 /etc/shutdownlog'
or
who -r
Anyone for a Mutiny ?
Robert A. Pierce
Frequent Advisor

Re: email


I've been wondering about this myself. I think it might be possible to put something in inittab to send an e-mail when the system goes to runlevel 3 (on ipl after starting networking) and in /sbin/rc3.d to send an e-mail before the system goes from runlevel 3 to runlevel 2.

I'm not sure of the correct syntax, however.

Maybe something like this?

#!/sbin/sh
# E-mail on system start/stop
case $1 in
'start_msg')
echo "Sending startup e-mail"
;;
'stop_msg')
echo "Sending stop e-mail"
;;
'start')
echo "System start: `hostname` `date`" | elm -s"system start" sysadmin@example.org
;;
'stop')
tail /var/adm/syslog/syslog.log | elm -s"System `hostname` shutdown at `date`" sysadmin@example.org
;;
*)
echo "usage: $0 {start|stop}"
;;
esac
exit

Would that work, and if so, how would you set it up to run before networking shut down?

Rob
Fred Martin_1
Valued Contributor

Re: email

I have a script in /sbin/rc3.d that sends an email to me when the system boots. That's one way to know when the system comes back up.

One way to know if the server goes down, is to monitor it from another server. i.e. every 15 minutes you can ping the server from somewhere else, and have that machine contact you if the first server does not respond to a ping.
fmartin@applicatorssales.com
Fred Martin_1
Valued Contributor

Re: email

Did I say sends me an email? I meant to say - it sends an email to my pager.
fmartin@applicatorssales.com
RAC_1
Honored Contributor

Re: email

you can predict when m/c will go down.

The best way is to monitor it from other m/c and setting the mail on other m/c to send a mail to you in case it goes down.
There is no substitute to HARDWORK