Why did my CentOS 5 production server reboot?
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?
- Check /var/log/messages for the suspected time it rebooted
-
Put a one-liner in /etc/rc.local like:
/bin/date +%F_%T | /bin/mail -s "myhost was rebooted" [email protected]
Cheers
put following in cron
@reboot echo "rebooted" | mail root
there is also some other services out there that monitors your server, i'm pretty sure even godaddy should do it, not to mention they should look into that if its their server
As previously mentioned by Jason, check /var/log/messages (and/or /var/log/warn if you have it). Seeing as the box is owned by GoDaddy, call them and ask what's up with reboots. It could anything from a hardware glitch they don't know about (or are ignoring) to a reboot for a new kernel. Either way, they should now when/why it happens.