30 lines
610 B
Bash
30 lines
610 B
Bash
|
#!/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
|