Code: Select all
# config
:local email "xxxxx"
# create backup
/system backup cloud upload-file action=create-and-upload name="cloud_backup" replace="cloud_backup" password="xxxxxx";
# get info
:local date [/system/clock/get date];
:local identity [/system/identity/get name];
:local key [/system/backup/cloud/ get number=0 value-name=secret-download-key];
# send
/tool e-mail/ send from="xxxxxxx" port="587" password="xxxxx" tls=starttls to="$email" subject="$identity $date" body="$key";
Test scenario:
1. Run the command from terminal:
Code: Select all
:put [/system/backup/cloud/ get number=0 value-name=secret-download-key]
2. Run the script. It uploads backup and sends mail but without secret-download-key.
3. Run the same command (from point 1). It doesn't work, returns nothing.
4. Open new terminal, run the same command (from point 1). It works, returns the key.