Skip to content

Commit

Permalink
container log slightly improved
Browse files Browse the repository at this point in the history
  • Loading branch information
Echsecutor committed Aug 19, 2020
1 parent 3c4890b commit d62ee10
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions auto-hash-folder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ if [ ! -d "$1" ]; then
exit 1
fi


WHATCH_DIR=${1%/}

PATH_TO_MAIN=${2:-"epcis_event_hash_generator"}
Expand All @@ -38,12 +39,14 @@ inotifywait -m $WHATCH_DIR -e create -e moved_to |
if [[ "$POST_BINARY_URL" != "" ]]; then
echo -e "[...]\t Posting binary hashes to $POST_BINARY_URL"
EXIT_STATUS=0
echo >post.log
while read -r line; do
echo -e "\nPosting $line\n" >>post.log
python3 -c "import binascii; import sys; sys.stdout.buffer.write(binascii.unhexlify(\"${line:14:64}\"));" |
curl -s -i --data-binary "@-" --header "Content-Type: application/octet-stream" --header "X-Auth-Token: $POST_X_ATUH" "$POST_BINARY_URL" >post.log 2>&1 ||
curl -i --data-binary "@-" --header "Content-Type: application/octet-stream" --header "X-Auth-Token: $POST_X_AUTH" "$POST_BINARY_URL" >>post.log 2>&1 ||
EXIT_STATUS=$?
cat post.log
done <$out_file_path
cat post.log
if [[ "$EXIT_STATUS" == "0" ]]; then
echo -e "[done]\t posted."
else
Expand Down

0 comments on commit d62ee10

Please sign in to comment.