How to Set up Email when Your Server Reboots using Crontab and Mail?


If you want to get a email to warn you that your server (VPS, dedicated server or even shared hosting) reboots, then you can add a crontab job using crontab -e by adding the following line (remember to replace the email).

@reboot echo "Your VPS is rebooted" | mail -s "Reboot Warnings" [email protected]

The @reboot job executes when server reboots. The mail will send a email and -s switch specifies the title of the email followed by the email address.

You can connect this using IFTTT (If this then that) to enable a text message, maybe.

The following shows the email I’ve got when my VPS is updated and rebooted by QuickhostUK.

vps-reboot-email How to Set up Email when Your Server Reboots using Crontab and Mail? crontab vps webhosting

vps-reboot-email

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
232 words
Last Post: EasyCron
Next Post: How to Decode Hardware ID by VMProtect (using VBScript) ?

The Permanent URL is: How to Set up Email when Your Server Reboots using Crontab and Mail?

Leave a Reply