CentOS Auto Reboot Notification

Posted on 2012-09-06
Last Modified: 2012-09-10
I have my centos server configured to auto-reboot weekly.  Is there any way the server can send me an email alert when this occurs?
Question by:deklinm
    LVL 31

    Expert Comment

    Do you have a cron entry to reboot it or what?  If so, you can add a mail statement before that command.

    Author Comment

    Yes i have the crontab entry for reboot

    crontab -l
    01 04 * * * reboot

    How do i add an email notification?
    LVL 31

    Accepted Solution

    Do you have MTA or something on the machine?

    Can you do?

    echo "message" | mail -s  "Test msg" email@address

    Open in new window

    If not try mailx

    So then all you need to do is:

    01 04 * * * echo "Reboot alert" | mail -s "Reboot alert" email@address ; reboot

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
    SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now