Untangle 9.3 Backup Script

Untangle 9.3 Backup Script

for those of you that use the Backup script to an FTP Server, you will notice that operation breaks when you upgrade to 9.3. But why?

they changed the backup script name (prob. to stop this script from running) But due to the fact that they have made no forward strides to provide email “spooling” i will share what i did to side-step their paid product.

here’s the line that changed:

/usr/share/untangle/bin/ut-backup.sh* -o /tmp/$FILENAME

New Script

#! /bin/bash
# FTP server address
FTPSERVER=”ftpserveraddress”
# FTP user account
USER=”Z1-Datacenter”
# FTP password
PASS=”Z1-Datacenter”
# Backup filename
FILENAME=”ung.backup”
# Descriptive system name
SYSTEMNAME=”Z1-Datacenter”
# email subject
SUBJECT=”Router Backup Failed!”
# Email To
TOEMAIL=”email@domain.com”
# Email From
FROMEMAIL=”guardian@zwiegnet.com”
# Email text/message
EMAILMESSAGE=”/tmp/remotebackupmsg.txt”

#DO NOT EDIT BELOW
error=”0″
##################
function check_error
##################
{
if [[ $? -ne 0 ]]; then # check return code passed to function
error=”1″
fi
}
/usr/share/untangle/bin/ut-backup.sh* -o /tmp/$FILENAME
check_error
curl -Q “RNFR $FILENAME.5” -Q “RNTO $FILENAME.6” ftp://$FTPSERVER –user $USER:$PASS
curl -Q “RNFR $FILENAME.4” -Q “RNTO $FILENAME.5” ftp://$FTPSERVER –user $USER:$PASS
curl -Q “RNFR $FILENAME.3” -Q “RNTO $FILENAME.4” ftp://$FTPSERVER –user $USER:$PASS
curl -Q “RNFR $FILENAME.2” -Q “RNTO $FILENAME.3” ftp://$FTPSERVER –user $USER:$PASS
curl -Q “RNFR $FILENAME.1” -Q “RNTO $FILENAME.2” ftp://$FTPSERVER –user $USER:$PASS
curl -Q “RNFR $FILENAME” -Q “RNTO $FILENAME.1” ftp://$FTPSERVER –user $USER:$PASS
curl -T /tmp/$FILENAME ftp://$FTPSERVER –user $USER:$PASS
check_error
rm -rf /tmp/$FILENAME
if [ $error = “1” ]; then # check return code passed to function
echo “Untangle system ===$SYSTEMNAME=== is having problems with remote backup”>$EMAILMESSAGE
echo “Please check into this at your earliest convinience.”>>$EMAILMESSAGE
mailx -a “From:”$FROMEMAIL”” -s “$SUBJECT” “$TOEMAIL” < $EMAILMESSAGE
fi
exit;

 

That’s all i have, hope that helps anyone who uses untangle!