Koozali.org: home of the SME Server

Email when server goes down or comes online.

Offline Gert

  • *****
  • 208
  • +0/-0
    • http://www.huge.co.za
Email when server goes down or comes online.
« 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?

Offline mike_mattos

  • *
  • 313
  • +0/-0
Email when server goes down or comes online.
« Reply #1 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)
...

Offline Gert

  • *****
  • 208
  • +0/-0
    • http://www.huge.co.za
Email when server goes down or comes online.
« Reply #2 on: May 28, 2007, 06:57:47 PM »
You mean admin@domain.co.za?? Its still there. But that does not answer my question.

Offline shell

  • ****
  • 117
  • +0/-0
Email when server goes down or comes online.
« Reply #3 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

Offline Gert

  • *****
  • 208
  • +0/-0
    • http://www.huge.co.za
Email when server goes down or comes online.
« Reply #4 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.

Offline Gert

  • *****
  • 208
  • +0/-0
    • http://www.huge.co.za
Email when server goes down or comes online.
« Reply #5 on: May 29, 2007, 10:46:03 AM »
what about /etc/rc0.d/ and /etc/rc6.d  ??