Hi guys, I have created a backup script that will copy the content of ncdata to another server every 10 minutes and will not start when the preceeding run is not completed:
#!/bin/bash #Create the Locking dir if it doesn't exist if [[ ! -d "/lockdir/" ]]; then mkdir -p /lockdir/ fi #Check if there is currently a lock in place, if so then exit, if not then create a lock if [ -f "/lockdir/myscript.lock" ]; then echo "Backupscript is already running" exit else touch /lockdir/myscript.lock fi /usr/bin/rsync -aAx -e "ssh -p 5222" --delete --exclude 'nextcloud.log' "/media/drive/ncdata/" "pi@IP_SERVER:/media/data/ncdata/" #release the lock rm /lockdir/myscript.lock echo "Backup completed"
*/10 * * * * root /usr/local/bin/backup.sh
I can see the results in /var/mail/root but would like to receive an email.
Now I was wondering whats the best way to do this, would it be possible to use the email credentials I have saved in config.php for passwords resets etc?