#!/bin/bash

cd "$(dirname "$0")"

#echo "SMARTKIT_PRINTING_SERVICE_DIR" $1
#echo "PRN_SVC_NAME" $2

export TF_VAR_base_dir="${1}/${2}"
export TF_VAR_container_name="$2"
export TF_VAR_download_war_url="$3"

#echo "TF_VAR_base_dir" $TF_VAR_base_dir
#echo "TF_VAR_container_name" $TF_VAR_container_name


echo Download $TF_VAR_download_war_url
sudo -E curl $TF_VAR_download_war_url --fail --create-dirs --output $TF_VAR_base_dir/container/autodeploy/rdsv6.war
echo Restart container
sudo docker restart $TF_VAR_container_name

echo Update completed
