1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/log_file.sh Tue Jan 13 18:26:41 2015 +0100
1.3 @@ -0,0 +1,21 @@
1.4 +#!/bin/bash
1.5 +
1.6 +# ------------------------------------------------------
1.7 +# sample test file for checking the logiing
1.8 +# ------------------------------------------------------
1.9 +
1.10 +FILE_TO_LOG=${1}
1.11 +if [ -z "${FILE_TO_LOG}" ]; then
1.12 + echo "please specify file name to log"
1.13 + exit 1
1.14 +fi
1.15 +FILE_TO_LOG=$(readlink -f ${FILE_TO_LOG})
1.16 +
1.17 +FILE_TIMESTAMP=$(date +"%s") # unix epoch timestamp
1.18 +FILE_CHECKSUM=$(md5sum < "${1}" | gawk '{ print $1; }') # MD5-Checksum
1.19 +
1.20 +OPENSECURITY_URL="http://localhost:8090/log"
1.21 +
1.22 +# POST the log
1.23 +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}
1.24 +