log_file.sh
author BarthaM@N3SIM1218.D03.arc.local
Fri, 05 Sep 2014 12:28:30 +0100
changeset 221 853af9cfab6a
parent 142 709cbb3b16de
permissions -rwxr-xr-x
Integrated import script (rewritten in python) into opensecurity/vmmanager.py
Improoved user feedback upon import and update as well as logging.
Reduced system shutdown times and ui response times
Improoved the decoupling between UI and OSec subsystem.
Various other fixes
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