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