This is a script, that will copy selected folders from TrueNas Server to an external USB disk – for creating an offline backup of the data. The credentials are stored in the file /etc/local/msmtprc
#!/bin/sh # # This script copy backupSTOR1=’/mnt/data/veeam’ STOR2=’/mnt/USB’ LOG=’/tmp/backup.log’# Starting the scripts # Test if USB is created if [ -d “$STOR2” ]; then echo “Folder $STOR2 exist …” >> $LOG else echo “No $STOR2 folder exist” >> $LOG exit fi # Copying the data echo “Finished backing up the data” >> $LOG
# Sending email as information
/usr/local/bin/msmtp –file=${msmtp_config:-“/etc/local/msmtprc”} TEST@EXAMPLE.com < /tmp/backup.log
# Finishing the script – delete /tmp files
rm -rf $LOG
#EOF
|