Hello friends. OMV is my main server, but I have a basic Ubuntu Server running on a separate box. It turns on automatically via wakeonlan (WOL) from OMV, waits 5 minutes (in case a disk check kicks in), rsyncs my data, and remotely shuts it down. Here's what it does.
ZitatAlles anzeigen#!/bin/bash
set -e
wakeonlan 00:1C:C0:90:34:DE
sleep 5m
rsync -a /media/2f730da3-263d-473f-af11-cc955e3158ef/Documents jason@192.168.1.201:/media/backup/
rsync -a /media/2f730da3-263d-473f-af11-cc955e3158ef/Pictures jason@192.168.1.201:/media/backup/
rsync -a /media/2f730da3-263d-473f-af11-cc955e3158ef/Music jason@192.168.1.201:/media/backup/
rsync -a /media/2f730da3-263d-473f-af11-cc955e3158ef/Public jason@192.168.1.201:/media/backup/
rsync -a /media/2f730da3-263d-473f-af11-cc955e3158ef/Backups jason@192.168.1.201:/media/backup/
rsync -a /media/2f730da3-263d-473f-af11-cc955e3158ef/ownCloud jason@192.168.1.201:/media/backup/
date >> /media/2f730da3-263d-473f-af11-cc955e3158ef/Backups/backup_logs/backup_server.txt
sleep 1m
ssh jason@192.168.1.201 sudo shutdown -h now
exit
I like this because it ensures my "backup" server is only on when necessary and not using 24 hours of daily electricity for 10-12 minutes worth of actual use.
When this command completes, or even returns an error, I don't get an email. I'd like to get an email of the output regardless, whether successful or not. I tested this by changing the source path (/media/UUID) to something that was intentionally wrong and ran it from terminal. I saw it fail, but never got an email. Later I corrected it, ran it, saw it succeed, but never got an email.
Is there a way to edit this so I get an email notification whether success or fail?