• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 446
  • Last Modified:

CentOS Auto Reboot Notification

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?
0
deklinm
Asked:
deklinm
  • 2
1 Solution
 
farzanjCommented:
Do you have a cron entry to reboot it or what?  If so, you can add a mail statement before that command.
0
 
deklinmAuthor Commented:
Yes i have the crontab entry for reboot

crontab -l
01 04 * * * reboot


How do i add an email notification?
0
 
farzanjCommented:
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

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now