I have a CentOS 5.2 box running my production web server (Apache 2 + Mongrel_cluster) for a Ruby on Rails project. The machine is hosted by GoDaddy.com and is a "virtual private server". The system periodically reboots on its own (maybe once every 6 months). I have two questions:
- How can I determine why my machine rebooted?
- Is there a good way to automagically notify me (i.e. via e-mail) when the system reboots?
Best Answer
Put a one-liner in /etc/rc.local like:
/bin/date +%F_%T | /bin/mail -s "myhost was rebooted" me@example.com
Cheers