@@ -94,7 +94,6 @@ __UAC_S3_TOKEN=""
9494__UAC_AWS_S3_PRESIGNED_URL=" "
9595__UAC_AWS_S3_PRESIGNED_URL_LOG_FILE=" "
9696__UAC_AZURE_STORAGE_SAS_URL=" "
97- __UAC_AZURE_STORAGE_SAS_URL_LOG_FILE=" "
9897__UAC_DELETE_LOCAL_ON_SUCCESSFUL_TRANSFER=false
9998__UAC_DESTINATION_DIR=" "
10099__UAC_USER_HOME_LIST=" "
@@ -268,31 +267,38 @@ if [ -n "${__UAC_AWS_S3_PRESIGNED_URL}" ]; then
268267 if [ " ${__UAC_OUTPUT_FORMAT} " = " none" ]; then
269268 _exit_fatal " AWS S3 transfer aborted: Output format is set to 'none'."
270269 fi
271- __UAC_AWS_S3_PRESIGNED_URL=` echo " ${__UAC_AWS_S3_PRESIGNED_URL} " \
272- | sed -e " s|%hostname%|${__UAC_HOSTNAME} |g" \
273- -e " s|%os%|${__UAC_OPERATING_SYSTEM} |g" \
274- -e " s|%timestamp%|${__ua_current_date_time} |g" `
275- printf " Validating connectivity to the AWS S3 presigned URL...\n"
276- _aws_s3_presigned_url_transfer \
277- " " \
278- " ${__UAC_AWS_S3_PRESIGNED_URL} " \
279- || _exit_fatal " Failed to connect to the AWS S3 presigned URL."
270+ if command_exists " curl" || command_exists " wget" ; then
271+ __UAC_AWS_S3_PRESIGNED_URL=` echo " ${__UAC_AWS_S3_PRESIGNED_URL} " \
272+ | sed -e " s|%hostname%|${__UAC_HOSTNAME} |g" \
273+ -e " s|%os%|${__UAC_OPERATING_SYSTEM} |g" \
274+ -e " s|%timestamp%|${__ua_current_date_time} |g" `
275+ printf " Validating connectivity to the AWS S3 presigned URL...\n"
276+ _aws_s3_presigned_url_transfer \
277+ " " \
278+ " ${__UAC_AWS_S3_PRESIGNED_URL} " \
279+ || _exit_fatal " Failed to connect to the AWS S3 presigned URL."
280+ else
281+ _exit_fatal " Cannot transfer to AWS S3 presigned URL: neither 'curl' nor 'wget' is available."
282+ fi
280283fi
281284
282285# test the connectivity to Azure Storage SAS URL
283286if [ -n " ${__UAC_AZURE_STORAGE_SAS_URL} " ]; then
284287 if [ " ${__UAC_OUTPUT_FORMAT} " = " none" ]; then
285288 _exit_fatal " Azure Storage SAS URL transfer aborted: Output format is set to 'none'."
286289 fi
287- __UAC_AZURE_STORAGE_SAS_URL=` echo " ${__UAC_AZURE_STORAGE_SAS_URL} " \
288- | sed -e " s|%hostname%|${__UAC_HOSTNAME} |g" \
289- -e " s|%os%|${__UAC_OPERATING_SYSTEM} |g" \
290- -e " s|%timestamp%|${__ua_current_date_time} |g" `
291- printf " Validating connectivity to the Azure Storage SAS URL...\n"
292- _azure_storage_sas_url_transfer \
293- " " \
294- " ${__UAC_AZURE_STORAGE_SAS_URL} " \
295- || _exit_fatal " Failed to connect to the Azure Storage SAS URL."
290+ if command_exists " curl" || command_exists " wget" ; then
291+ # add output file name to Azure Storage SAS URL
292+ __UAC_AZURE_STORAGE_SAS_URL_TEMP=` echo " ${__UAC_AZURE_STORAGE_SAS_URL} " | sed -e " s|?|/transfer_test_from_uac.txt?|" `
293+
294+ printf " Validating connectivity to the Azure Storage SAS URL...\n"
295+ _azure_storage_sas_url_transfer \
296+ " " \
297+ " ${__UAC_AZURE_STORAGE_SAS_URL_TEMP} " \
298+ || _exit_fatal " Failed to connect to the Azure Storage SAS URL."
299+ else
300+ _exit_fatal " Cannot transfer to Azure Storage SAS URL: neither 'curl' nor 'wget' is available."
301+ fi
296302fi
297303
298304# check whether temp-dir exists
@@ -660,15 +666,15 @@ if [ -n "${__UAC_S3_PROVIDER}" ] && [ -n "${__UAC_S3_BUCKET}" ]; then
660666 case " ${__UAC_S3_PROVIDER} " in
661667 " amazon" )
662668 printf " Transferring '%s' to S3 server...\n" \
663- " ${__UAC_DESTINATION_DIR} /${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.} ${__UAC_OUTPUT_EXTENSION} "
669+ " ${__UAC_DESTINATION_DIR} /${__UAC_OUTPUT_BASE_NAME} . ${__UAC_OUTPUT_EXTENSION} "
664670 if _s3_transfer_amazon \
665- " ${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.} ${__UAC_OUTPUT_EXTENSION} " \
671+ " ${__UAC_OUTPUT_BASE_NAME} . ${__UAC_OUTPUT_EXTENSION} " \
666672 " ${__UAC_S3_REGION} " \
667673 " ${__UAC_S3_BUCKET} " \
668674 " ${__UAC_S3_ACCESS_KEY} " \
669675 " ${__UAC_S3_SECRET_KEY} " ; then
670676 printf " Transfer completed successfully.\n"
671- ${__UAC_DELETE_LOCAL_ON_SUCCESSFUL_TRANSFER} && rm -rf " ${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.} ${__UAC_OUTPUT_EXTENSION} "
677+ ${__UAC_DELETE_LOCAL_ON_SUCCESSFUL_TRANSFER} && rm -rf " ${__UAC_OUTPUT_BASE_NAME} . ${__UAC_OUTPUT_EXTENSION} "
672678 else
673679 _error_msg " Failed to transfer output file to the S3 server."
674680 fi
@@ -687,13 +693,13 @@ if [ -n "${__UAC_S3_PROVIDER}" ] && [ -n "${__UAC_S3_BUCKET}" ]; then
687693 ;;
688694 " google" )
689695 printf " Transferring '%s' to S3 server...\n" \
690- " ${__UAC_DESTINATION_DIR} /${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.} ${__UAC_OUTPUT_EXTENSION} "
696+ " ${__UAC_DESTINATION_DIR} /${__UAC_OUTPUT_BASE_NAME} . ${__UAC_OUTPUT_EXTENSION} "
691697 if _s3_transfer_google \
692- " ${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.} ${__UAC_OUTPUT_EXTENSION} " \
698+ " ${__UAC_OUTPUT_BASE_NAME} . ${__UAC_OUTPUT_EXTENSION} " \
693699 " ${__UAC_S3_BUCKET} " \
694700 " ${__UAC_S3_TOKEN} " ; then
695701 printf " Transfer completed successfully.\n"
696- ${__UAC_DELETE_LOCAL_ON_SUCCESSFUL_TRANSFER} && rm -rf " ${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.} ${__UAC_OUTPUT_EXTENSION} "
702+ ${__UAC_DELETE_LOCAL_ON_SUCCESSFUL_TRANSFER} && rm -rf " ${__UAC_OUTPUT_BASE_NAME} . ${__UAC_OUTPUT_EXTENSION} "
697703 else
698704 _error_msg " Failed to transfer output file to the S3 server."
699705 fi
@@ -710,14 +716,14 @@ if [ -n "${__UAC_S3_PROVIDER}" ] && [ -n "${__UAC_S3_BUCKET}" ]; then
710716 ;;
711717 " ibm" )
712718 printf " Transferring '%s' to S3 server...\n" \
713- " ${__UAC_DESTINATION_DIR} /${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.} ${__UAC_OUTPUT_EXTENSION} "
719+ " ${__UAC_DESTINATION_DIR} /${__UAC_OUTPUT_BASE_NAME} . ${__UAC_OUTPUT_EXTENSION} "
714720 if _s3_transfer_ibm \
715- " ${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.} ${__UAC_OUTPUT_EXTENSION} " \
721+ " ${__UAC_OUTPUT_BASE_NAME} . ${__UAC_OUTPUT_EXTENSION} " \
716722 " ${__UAC_S3_REGION} " \
717723 " ${__UAC_S3_BUCKET} " \
718724 " ${__UAC_S3_TOKEN} " ; then
719725 printf " Transfer completed successfully.\n"
720- ${__UAC_DELETE_LOCAL_ON_SUCCESSFUL_TRANSFER} && rm -rf " ${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.} ${__UAC_OUTPUT_EXTENSION} "
726+ ${__UAC_DELETE_LOCAL_ON_SUCCESSFUL_TRANSFER} && rm -rf " ${__UAC_OUTPUT_BASE_NAME} . ${__UAC_OUTPUT_EXTENSION} "
721727 else
722728 _error_msg " Failed to transfer output file to the S3 server."
723729 fi
741747if [ -n " ${__UAC_AWS_S3_PRESIGNED_URL} " ]; then
742748 cd " ${__UAC_DESTINATION_DIR} " || _exit_fatal " cd: ${__UAC_DESTINATION_DIR} : No such file or directory"
743749 printf " Transferring '%s' to Amazon S3 presigned URL...\n" \
744- " ${__UAC_DESTINATION_DIR} /${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.} ${__UAC_OUTPUT_EXTENSION} "
750+ " ${__UAC_DESTINATION_DIR} /${__UAC_OUTPUT_BASE_NAME} . ${__UAC_OUTPUT_EXTENSION} "
745751 if _aws_s3_presigned_url_transfer \
746- " ${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.} ${__UAC_OUTPUT_EXTENSION} " \
752+ " ${__UAC_OUTPUT_BASE_NAME} . ${__UAC_OUTPUT_EXTENSION} " \
747753 " ${__UAC_AWS_S3_PRESIGNED_URL} " ; then
748754 printf " Transfer completed successfully.\n"
749- ${__UAC_DELETE_LOCAL_ON_SUCCESSFUL_TRANSFER} && rm -rf " ${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.} ${__UAC_OUTPUT_EXTENSION} "
755+ ${__UAC_DELETE_LOCAL_ON_SUCCESSFUL_TRANSFER} && rm -rf " ${__UAC_OUTPUT_BASE_NAME} . ${__UAC_OUTPUT_EXTENSION} "
750756 else
751757 _error_msg " Failed to transfer output file to the S3 server."
752758 fi
753759 if [ -n " ${__UAC_AWS_S3_PRESIGNED_URL_LOG_FILE} " ]; then
754- __UAC_AWS_S3_PRESIGNED_URL_LOG_FILE=` echo " ${__UAC_AWS_S3_PRESIGNED_URL_LOG_FILE} " \
755- | sed -e " s|%hostname%|${__UAC_HOSTNAME} |g" \
756- -e " s|%os%|${__UAC_OPERATING_SYSTEM} |g" \
757- -e " s|%timestamp%|${__ua_current_date_time} |g" `
758760 printf " Transferring '%s' to Amazon S3 presigned URL...\n" " ${__UAC_DESTINATION_DIR} /${__UAC_OUTPUT_BASE_NAME} .log"
759761 if _aws_s3_presigned_url_transfer \
760762 " ${__UAC_OUTPUT_BASE_NAME} .log" \
761763 " ${__UAC_AWS_S3_PRESIGNED_URL_LOG_FILE} " ; then
762764 printf " Transfer completed successfully.\n"
763- ${__UAC_DELETE_LOCAL_ON_SUCCESSFUL_TRANSFER} && rm -rf " ${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.}${__UAC_OUTPUT_EXTENSION} "
765+ ${__UAC_DELETE_LOCAL_ON_SUCCESSFUL_TRANSFER} && rm -rf " ${__UAC_OUTPUT_BASE_NAME} .log "
764766 else
765- _error_msg " Failed to transfer output file to the S3 server."
767+ _error_msg " Failed to transfer log file to the S3 server."
766768 fi
767769 fi
768770 cd " ${__UAC_DIR} " || _exit_fatal " cd: ${__UAC_DIR} : No such file or directory"
769771fi
770772
771773# transfer output and log file to Azure Storage SAS URL
772774if [ -n " ${__UAC_AZURE_STORAGE_SAS_URL} " ]; then
775+ # add output file name to Azure Storage SAS URL
776+ __UAC_AZURE_STORAGE_SAS_URL_TEMP=` echo " ${__UAC_AZURE_STORAGE_SAS_URL} " | sed -e " s|?|/${__UAC_OUTPUT_BASE_NAME} .${__UAC_OUTPUT_EXTENSION} ?|" `
777+
778+ __UAC_AZURE_STORAGE_SAS_URL_TEMP=` echo " ${__UAC_AZURE_STORAGE_SAS_URL_TEMP} " \
779+ | sed -e " s|%hostname%|${__UAC_HOSTNAME} |g" \
780+ -e " s|%os%|${__UAC_OPERATING_SYSTEM} |g" \
781+ -e " s|%timestamp%|${__ua_current_date_time} |g" `
782+
773783 cd " ${__UAC_DESTINATION_DIR} " || _exit_fatal " cd: ${__UAC_DESTINATION_DIR} : No such file or directory"
774784 printf " Transferring '%s' to Azure Storage SAS URL...\n" \
775- " ${__UAC_DESTINATION_DIR} /${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.} ${__UAC_OUTPUT_EXTENSION} "
785+ " ${__UAC_DESTINATION_DIR} /${__UAC_OUTPUT_BASE_NAME} . ${__UAC_OUTPUT_EXTENSION} "
776786 if _azure_storage_sas_url_transfer \
777- " ${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.} ${__UAC_OUTPUT_EXTENSION} " \
778- " ${__UAC_AZURE_STORAGE_SAS_URL } " ; then
787+ " ${__UAC_OUTPUT_BASE_NAME} . ${__UAC_OUTPUT_EXTENSION} " \
788+ " ${__UAC_AZURE_STORAGE_SAS_URL_TEMP } " ; then
779789 printf " Transfer completed successfully.\n"
780- ${__UAC_DELETE_LOCAL_ON_SUCCESSFUL_TRANSFER} && rm -rf " ${__UAC_OUTPUT_BASE_NAME}${__UAC_OUTPUT_EXTENSION : +.} ${__UAC_OUTPUT_EXTENSION} "
790+ ${__UAC_DELETE_LOCAL_ON_SUCCESSFUL_TRANSFER} && rm -rf " ${__UAC_OUTPUT_BASE_NAME} . ${__UAC_OUTPUT_EXTENSION} "
781791 else
782792 _error_msg " Failed to transfer output file to Azure Storage SAS URL."
783793 fi
784- if [ -n " ${__UAC_AZURE_STORAGE_SAS_URL_LOG_FILE} " ]; then
785- __UAC_AZURE_STORAGE_SAS_URL_LOG_FILE=` echo " ${__UAC_AZURE_STORAGE_SAS_URL_LOG_FILE} " \
786- | sed -e " s|%hostname%|${__UAC_HOSTNAME} |g" \
787- -e " s|%os%|${__UAC_OPERATING_SYSTEM} |g" \
788- -e " s|%timestamp%|${__ua_current_date_time} |g" `
789- printf " Transferring '%s' to Azure Storage SAS URL...\n" " ${__UAC_DESTINATION_DIR} /${__UAC_OUTPUT_BASE_NAME} .log"
790- if _azure_storage_sas_url_transfer \
791- " ${__UAC_OUTPUT_BASE_NAME} .log" \
792- " ${__UAC_AZURE_STORAGE_SAS_URL_LOG_FILE} " ; then
793- printf " Transfer completed successfully.\n"
794- ${__UAC_DELETE_LOCAL_ON_SUCCESSFUL_TRANSFER} && rm -rf " ${__UAC_OUTPUT_BASE_NAME} .log"
795- else
796- _error_msg " Failed to transfer output file to Azure Storage SAS URL."
797- fi
794+ # add output file name to Azure Storage SAS URL
795+ __UAC_AZURE_STORAGE_SAS_URL_TEMP=` echo " ${__UAC_AZURE_STORAGE_SAS_URL} " | sed -e " s|?|/${__UAC_OUTPUT_BASE_NAME} .log?|" `
796+
797+ __UAC_AZURE_STORAGE_SAS_URL_TEMP=` echo " ${__UAC_AZURE_STORAGE_SAS_URL_TEMP} " \
798+ | sed -e " s|%hostname%|${__UAC_HOSTNAME} |g" \
799+ -e " s|%os%|${__UAC_OPERATING_SYSTEM} |g" \
800+ -e " s|%timestamp%|${__ua_current_date_time} |g" `
801+ printf " Transferring '%s' to Azure Storage SAS URL...\n" " ${__UAC_DESTINATION_DIR} /${__UAC_OUTPUT_BASE_NAME} .log"
802+ if _azure_storage_sas_url_transfer \
803+ " ${__UAC_OUTPUT_BASE_NAME} .log" \
804+ " ${__UAC_AZURE_STORAGE_SAS_URL_TEMP} " ; then
805+ printf " Transfer completed successfully.\n"
806+ ${__UAC_DELETE_LOCAL_ON_SUCCESSFUL_TRANSFER} && rm -rf " ${__UAC_OUTPUT_BASE_NAME} .log"
807+ else
808+ _error_msg " Failed to transfer log file to Azure Storage SAS URL."
798809 fi
799810 cd " ${__UAC_DIR} " || _exit_fatal " cd: ${__UAC_DIR} : No such file or directory"
800811fi
0 commit comments