Sending a success email for a Cloud Sync task

Introduction

These days, a friend pointed out to me that there is no email notification when a Cloud Sync task has been successfully completed. Unfortunately, the alarm settings can only be set to send an email in the event of an error.

alarmtasks.png

Adjust Job

However, this can be easily retrofitted via a line in the Cloud Sync task via the "Post-script" field. Any shell commands can be entered in this field, which will be executed if successful. This includes the simple command mail(1), which is built into FreeBSD. Conveniently, this command uses the e-mail settings stored under "System - E-mail".

echo -e "Name: $CLOUD_SYNC_DESCRIPTION \r\n Direction: $CLOUD_SYNC_DIRECTION \r\n Local path: $CLOUD_SYNC_PATH \r\n Remote Path: $CLOUD_SYNC_FOLDER" | mail -v -s "[$HOSTNAME] $CLOUD_SYNC_DESCRIPTION Backup successfully completed" email@adresse.de

This command also uses the predefined Enviroment Variables, which can be used with the task:

  • $CLOUD_SYNC_DESCRIPTION = Task name
  • $CLOUD_SYNC_DIRECTION = Which direction is copied (push / pull)
  • $CLOUD_SYNC_PATH = Local path
  • $CLOUD_SYNC_FOLDER = Remote Cloud Path
  • \r\n provides a line break

Simply replace the email@adresse.de with your own email address and then paste the following into the "Post-script" field:

postscript.png

The e-mail will then look like this (but may of course be adapted to your own requirements):

email.png

Voilá