This commit is contained in:
root 2024-03-19 02:20:12 +02:00
commit 77de9c7b6e

29
trigger-a-backup.sh Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
DEBUG="0"
ROUTEROS_HOST="$1"
USERNAME="$2"
PASSWORD="$3"
BACKUP_FILENAME="$4"
if [ -z "${BACKUP_FILENAME}" ]
then
echo "Missing backup filename" >&2
exit 1
fi
if [ ! -z "${BACKUP_FILENAME}" ]
then
if [ "${DEBUG}" -gt "0" ];then
echo -n "DEBUG LEVEL 1: Working on CIDR: " >&2
echo "${i}" >&2
fi
COMMAND_RES=$(curl -v -k -u ${USERNAME}:${PASSWORD} -X POST "https://${ROUTEROS_HOST}/rest/system/backup/save" \
-H "content-type: application/json" \
--data "{\"dont-encrypt\": \"yes\", \"name\": \"${BACKUP_FILENAME}\"}")
echo "${COMMAN_RES}"
fi