Results 1 to 6 of 6

Thread: Reboot Alert?

  1. #1
    Join Date
    Nov 2013
    Posts
    182

    Reboot Alert?

    Is there a way to make CentOS send me an email anytime the server reboots or a workaround to do so? My server rebooted randomly and I had no idea about it until several hours later and the MySQL service failed to restart upon reboot due to,

    Code:
    Another MySQL daemon already running with the same unix socket
    Which requires manual intervention to resolve and is a crucial service.

  2. #2
    Join Date
    Dec 2012
    Posts
    218
    You can use third party monitoring tool to monitor your server. It will send you alert when your server becomes unresponsive.
    TronicHost.com - Offshore Web Hosting Provider. Netherlands/Romania || 24x7 Support
    Shared/Reseller Hosting | Offshare VPS/Dedicated Server. Paypal/Perfectmony/Payza/Bitcoin accepted

  3. #3
    Join Date
    Dec 2007
    Location
    LocalHost
    Posts
    1,303
    Yes, use free service like pingdom to monitor your server. You will get instant email alert when your server is unresponsive.
    YagHost - Pure SSD Hosting | Since 2007 | Average Response Time: 15 min
    Web Hosting | Reseller Hosting | Managed VPS Hosting
    99.9% Server Uptime Guarantee | 24/7 Rapid Response Tech Support | 30 Day Money Back Guarantee
    LopHost.com - Web Hosting Tutorials

  4. #4
    Join Date
    May 2013
    Location
    India
    Posts
    748
    You have some options to set an alerts email on the server itself.

    1. If its a graceful restart, set a cronjob like following.

    2. Create an init script that will send an email in event of startup or shutdown. Then start is and run "chkconfig <script name> on"

    Anyway, what exact issue you are facing with MySQl auto start up? if its not starting up after reboot, make sure its enabled on all run levels. Else run "chkconfig mysql on" and that will turn on MySQL on network enabled run levels. If its something else, script your solution, make it executable, put the script location to /etc/rc.local which will be executed after every reboot; though applying a permanent fix is recommended.

  5. #5
    Join Date
    Aug 2012
    Posts
    55
    You can also use this simple script. It will send an email if the server uptime is less than one minute (it requires 'mailx' RPM package). You can add a cron job so it runs every 5 minutes:

    */5 * * * * root /path/uptime.sh
    #!/usr/bin/env bash

    uptime=$(</proc/uptime)
    uptime=${uptime%%.*}
    email="[email protected]"

    if [ "$uptime" -lt 60 ]; then

    echo -e "Server: $(hostname)\nUptime: $(uptime)" | mail -s "Uptime alert for: $(hostname) [$(date)]" $email

    fi
    You should definitely investigate what is the cause of these reboots and fix it.
    VPSSHELL.CO.UK | UK VPS Hosting Solutions | Reliable and Fast Internet Services

  6. #6
    Install monit - it will send you notifications when a service status changes (including reboots) - it will also try to restart the service for you.

Similar Threads

  1. Reboot 101: Reboot != Reboot??
    By UpdownUp in forum VPS Hosting
    Replies: 5
    Last Post: 07-20-2010, 11:32 AM
  2. Server Reboot Through Remote Reboot...
    By JohnGladen in forum Dedicated Server
    Replies: 16
    Last Post: 11-04-2006, 07:16 PM
  3. Web Remote Reboot w/ AutoPing Reboot
    By page-zone in forum Dedicated Server
    Replies: 12
    Last Post: 10-02-2006, 06:54 AM
  4. How often to reboot?
    By PixelManual in forum Dedicated Server
    Replies: 13
    Last Post: 09-26-2005, 05:27 AM
  5. why IE reboot>?
    By rackdog.com in forum Hosting Security and Technology
    Replies: 0
    Last Post: 05-13-2005, 03:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •