28 lines
436 B
Bash
28 lines
436 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
DEBUG="0"
|
||
|
|
||
|
set -x
|
||
|
ROUTEROS_HOST="$1"
|
||
|
USERNAME="$2"
|
||
|
PASSWORD="$3"
|
||
|
|
||
|
SCRIPT_NAME="$4"
|
||
|
|
||
|
SCRIPT_FILENAME="$5"
|
||
|
|
||
|
if [ ! -z "${SCRIPT_NAME}" ]
|
||
|
then
|
||
|
|
||
|
DATA=$( ruby text-file-to-json.rb ${SCRIPT_NAME} ${SCRIPT_FILENAME} )
|
||
|
ADD_RES=$(\
|
||
|
curl -q -k -u ${USERNAME}:${PASSWORD} -X POST "https://${ROUTEROS_HOST}/rest/system/script/add" \
|
||
|
-H "content-type: application/json" \
|
||
|
--data "${DATA}" \
|
||
|
)
|
||
|
echo "${ADD_RES}"
|
||
|
fi
|
||
|
|
||
|
|
||
|
set +x
|