#!/bin/bash

# ------------------------------------------------------
# sample test file for checking the logiing
# ------------------------------------------------------

FILE_TO_LOG=${1}
if [ -z "${FILE_TO_LOG}" ]; then
    echo "please specify file name to log"
    exit 1
fi
FILE_TO_LOG=$(readlink -f ${FILE_TO_LOG})

FILE_TIMESTAMP=$(date +"%s")                                # unix epoch timestamp
FILE_CHECKSUM=$(md5sum < "${1}" | gawk '{ print $1; }')     # MD5-Checksum

OPENSECURITY_URL="http://localhost:8090/log"

# POST the log
curl --data-urlencode "file=${FILE_TO_LOG}" --data-urlencode "checksum=${FILE_CHECKSUM}" --data-urlencode "timestamp=${FILE_TIMESTAMP}" --data-urlencode 'action=copy' --data-urlencode 'memo=copied to unsafe USB Drive G:\\' ${OPENSECURITY_URL}

