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