Operating System - Linux
1753781 Members
7443 Online
108799 Solutions
New Discussion юеВ

Re: System shutdown alert email.

 

System shutdown alert email.

I am trying a script that sends an email alert to the admin when a REDHAT linux system shutdown occurs.
Can any one help me out with this.

Is there any other solution to archieve this?
I know through ups daemon it is possible.Any other option
To get out of a difficulty, one usually must go through it
5 REPLIES 5
Martin P.J. Zinser
Honored Contributor

Re: System shutdown alert email.

Hello Nuwan,

my SuSE Linux has a /etc/rc.d/halt.local to put in all the local shutdown stuff. If Redhat does not have this you would need to plug a K(ill) script in one of the individual rcx.d directories.

Greetings, Martin
Steven E. Protter
Exalted Contributor

Re: System shutdown alert email.

At any point before sendmail is shut down you can do this:

put a standard startup script in /etc/init.d

In the stop section, have it use sendmail to send you an email. Use the fullpath of all commands.

cd to the shutdown directory and use ln -s to make a soft link to your script. Make sure the new file starts with a capital K

It will email you unless someon yanks the plug out of the UPS or pulls the NIC cable or turns off the switch.

There are always circumstances that will cause you a problem. Thats why computer rooms have operators.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Mark Grant
Honored Contributor

Re: System shutdown alert email.

Personally, I think it is better to get one machine to monitor another and alert if it can't be contacted. There are so many reasons why a machine shutting down wouldn't be able to send an e-mail that it is too unreliable to depend on.
Never preceed any demonstration with anything more predictive than "watch this"
Toni Niemi
Occasional Advisor

Re: System shutdown alert email.

I share Mark's opinion. I have server room with several dozens of servers. windows, unix, linux + some network swithces that are vital for our business. I have added simple script in two linux servers cron that uses ping and grep to verify if a device stops responding and third linux server have gnokii(GNU software) and nokia cellphone attached with serial cable to enable alerts with sms immidiatedly telling me which server has stopped responding. topology of these three servers is that one is primary monitoring server that monitors all devices. other is secondary that monitors primary. Sms linux server is in third computer to prevent sms flush comparing if same computer would be able to monitor and send sms and would be disconnected from the netrowk... There are some weaknesses but it's cost are minimal and have allready shown its efficiency saving a lot of working hours from employees in form of minimal responce time to server room problems day and night. Linux here is REDHAT.
There is unlimited amount of information but very limited amount of time
Robert Binkhorst
Trusted Contributor

Re: System shutdown alert email.

Hi,

You can try nagios (www.nagios.org) to monitor your sites from a central server. This will sound an alarm or send an email when one of your servers goes down.

HTH,

Robert
linux: the choice of a GNU generation