author | Oliver Maurhart <oliver.maurhart@ait.ac.at> |
Fri, 28 Nov 2014 15:54:20 +0100 | |
changeset 251 | d3eb2d026666 |
parent 142 | 709cbb3b16de |
permissions | -rwxr-xr-x |
oliver@142 | 1 |
#!/bin/bash |
oliver@142 | 2 |
|
oliver@142 | 3 |
# ------------------------------------------------------ |
oliver@142 | 4 |
# sample test file for checking the logiing |
oliver@142 | 5 |
# ------------------------------------------------------ |
oliver@142 | 6 |
|
oliver@142 | 7 |
FILE_TO_LOG=${1} |
oliver@142 | 8 |
if [ -z "${FILE_TO_LOG}" ]; then |
oliver@142 | 9 |
echo "please specify file name to log" |
oliver@142 | 10 |
exit 1 |
oliver@142 | 11 |
fi |
oliver@142 | 12 |
FILE_TO_LOG=$(readlink -f ${FILE_TO_LOG}) |
oliver@142 | 13 |
|
oliver@142 | 14 |
FILE_TIMESTAMP=$(date +"%s") # unix epoch timestamp |
oliver@142 | 15 |
FILE_CHECKSUM=$(md5sum < "${1}" | gawk '{ print $1; }') # MD5-Checksum |
oliver@142 | 16 |
|
oliver@142 | 17 |
OPENSECURITY_URL="http://localhost:8090/log" |
oliver@142 | 18 |
|
oliver@142 | 19 |
# POST the log |
oliver@142 | 20 |
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} |
oliver@142 | 21 |