From 09ebb5c0f49d9974fb120c24b4e5eb67ed873aaa Mon Sep 17 00:00:00 2001 From: Eliezer Croitoru Date: Sun, 31 Mar 2024 23:36:10 +0300 Subject: [PATCH] 2 --- add-system-script.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/add-system-script.sh b/add-system-script.sh index 1d10413..7727924 100755 --- a/add-system-script.sh +++ b/add-system-script.sh @@ -2,7 +2,6 @@ DEBUG="0" -set -x ROUTEROS_HOST="$1" USERNAME="$2" PASSWORD="$3" @@ -14,6 +13,11 @@ SCRIPT_FILENAME="$5" if [ ! -z "${SCRIPT_NAME}" ] then + if [ ! -f "${SCRIPT_FILENAME}" ] + then + echo "The file [ \"${SCRIPT_FILENMAE}\" ] is missing" >&2 + exit 1 + fi 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" \ @@ -22,6 +26,3 @@ curl -q -k -u ${USERNAME}:${PASSWORD} -X POST "https://${ROUTEROS_HOST}/rest/sys ) echo "${ADD_RES}" fi - - -set +x