Possible Duplicate:
Centos - Automatically issue a command after rebooting
I'd like to configure a server (Ubuntu) to send me an email whenever it reboots.
What would be the best way to do this?
I'd like to configure a server (Ubuntu) to send me an email whenever it reboots. What would be the best way to do this? |
|||
|
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
|
First ensure that you have sendmail installed on your server. You can easily install this by running Once this is complete, edit your root crontab (
The -s switch sets the subject of the email and the date command will insert the hour and time at which the server rebooted. |
|||
|
|
/etc/rc.local is supposed to be run on boot. You can call a script from there. Just make sure the exit code from your script is 0. |
|||
|
|
|
I've found that running Monit on a server, when configured to do so, lets me know every time it is restarted. Investigation follows. Plus doing it this way adds all the monitoring functionality that helps with other utilities and troubleshooting. The reboot notification is just a bonus; if you're running services on the server, or want a quick glance at the health of the server, this (or a similar package) is a good approach. At least it has been for us... |
||||
|
|
|
Put a correctly configured update-rc.d whateveryourscriptiscalled defaults |
|||
|
|