Files
Ben West b1ecbe3c91 introduce sgvdata, use it in api and storage
Clean up and comment a bunch of code.
2014-07-15 15:10:49 -07:00

24 lines
301 B
Bash
Executable File

#!/bin/bash
SGV=$1
DIRECTION=$2
AT=$3
OPTS=""
if [ -n "$AT" ]; then
OPTS="--date ${AT}"
fi
ISO=$(date -Iseconds $OPTS)
UNIX=$(date +%s $OPTS)
(
cat <<EOF
{ "sgv": "$SGV",
"device": "xxx-test-device",
"direction": "$DIRECTION",
"dateString": "$ISO",
"date": $UNIX
}
EOF
) | tr -d '\n'
echo