Ability to change backup destination
This commit is contained in:
@@ -33,6 +33,7 @@ docker run --detach --volume $(pwd):/data --env PFSENSE_USER=backupuser --env PF
|
|||||||
- `PFSENSE_SCHEME` Required. Should either be `http` or `https`. This parameter is not validated.
|
- `PFSENSE_SCHEME` Required. Should either be `http` or `https`. This parameter is not validated.
|
||||||
- `PFSENSE_CRON_SCHEDULE` Optional. The cron schedule to use, should contain 5 items separated by spaces. This parameter is not validated. No default.
|
- `PFSENSE_CRON_SCHEDULE` Optional. The cron schedule to use, should contain 5 items separated by spaces. This parameter is not validated. No default.
|
||||||
- `PFSENSE_BACK_UP_RRD_DATA`. Optional. Should be either 1 or 0. This parameters is not validated. Include RRD data in the backup? 1=yes, 0=no. Default=1.
|
- `PFSENSE_BACK_UP_RRD_DATA`. Optional. Should be either 1 or 0. This parameters is not validated. Include RRD data in the backup? 1=yes, 0=no. Default=1.
|
||||||
|
- `PFSENSE_BACKUP_DESTINATION_DIR`. Optional. What is the destination directory to back up to. This directory must exist and be writable. Default=/data
|
||||||
|
|
||||||
## Help!
|
## Help!
|
||||||
- Is the username correct?
|
- Is the username correct?
|
||||||
|
|||||||
+7
-2
@@ -16,10 +16,10 @@ function do_backup()
|
|||||||
|
|
||||||
wget --keep-session-cookies --load-cookies cookies.txt --no-check-certificate \
|
wget --keep-session-cookies --load-cookies cookies.txt --no-check-certificate \
|
||||||
--post-data "download=download${getrrd}&__csrf_magic=$(head -n 1 csrf2.txt)" \
|
--post-data "download=download${getrrd}&__csrf_magic=$(head -n 1 csrf2.txt)" \
|
||||||
${url}/diag_backup.php -q -O /data/config-${PFSENSE_IP}-${timestamp}.xml
|
${url}/diag_backup.php -q -O ${destination}/config-${PFSENSE_IP}-${timestamp}.xml
|
||||||
return_value=$?
|
return_value=$?
|
||||||
if [ $return_value -eq 0 ]; then
|
if [ $return_value -eq 0 ]; then
|
||||||
echo "Backup saved as config-${PFSENSE_IP}-${timestamp}.xml"
|
echo "Backup saved as ${destination}/config-${PFSENSE_IP}-${timestamp}.xml"
|
||||||
else
|
else
|
||||||
echo "Backup failed"
|
echo "Backup failed"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -48,6 +48,11 @@ else
|
|||||||
getrrd=""
|
getrrd=""
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [ -z "$PFSENSE_BACKUP_DESTINATION_DIR" ]; then
|
||||||
|
destination="/data"
|
||||||
|
else
|
||||||
|
destination="$PFSENSE_BACKUP_DESTINATION_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
# set up variables
|
# set up variables
|
||||||
url=${PFSENSE_SCHEME}://${PFSENSE_IP}
|
url=${PFSENSE_SCHEME}://${PFSENSE_IP}
|
||||||
|
|||||||
Reference in New Issue
Block a user