Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: Gert on May 27, 2007, 09:01:02 PM

Title: Email when server goes down or comes online.
Post by: Gert on May 27, 2007, 09:01:02 PM
Hi everyone.

I would like my servers to send me and email when it is restarted, shut down or switched on.

For "switched on" i did have added the following line to /etc/rc.local:

Quote
echo | mail -s "Server Online" me@domain.co.za


Seems to work fine. How can i achieve the same with shutting down and restarting?
Title: Email when server goes down or comes online.
Post by: mike_mattos on May 28, 2007, 06:54:53 PM
There used to be an email address for administrative notices, in the control panel, I wonder what happened to it?

( My searches didn't find any SME7 data)
Title: Email when server goes down or comes online.
Post by: Gert on May 28, 2007, 06:57:47 PM
You mean admin@domain.co.za?? Its still there. But that does not answer my question.
Title: Email when server goes down or comes online.
Post by: shell on May 28, 2007, 10:52:46 PM
/etc/e-smith/events/actions/

Have a look at the action scripts, see if you can modify those actions called on signal-event reboot and conf-statup.  you would need to look at the manual for information -
http://mirror.contribs.org/smeserver/contribs/gordonr/devguide/html/c382.htm
http://wiki.contribs.org/SME_Server:Documentation:Technical_Manual:Chapter3

these pages are a good start!  you will need to look at custom templating.

also you may be interested in sme7admin, which has a great server-manager panel and can email you with the status of the server at pre-determined intervals - you could make this every 1 hour, and then the absence of the email could give you an indication of server state.

just my 2c
Title: Email when server goes down or comes online.
Post by: Gert on May 29, 2007, 10:43:58 AM
Thank you for the reply.

I will play around with that. If the server is shutdown with the powerbutton I don't think that the reboot event will take place (i might be wrong) I am currently using sme7admin. very nice contrib.
Title: Email when server goes down or comes online.
Post by: Gert on May 29, 2007, 10:46:03 AM
what about /etc/rc0.d/ and /etc/rc6.d  ??