Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions drop_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@
# avg - send average
# no value: send latest value

WGET=/usr/local/bin/wget

DROPDIR="/tmp/drop_data"
DROPDIR="/tmp/drop_data/$UID"
mkdir $DROPDIR 2> /dev/null

BID_NAME=$1
if [ -z $BID_NAME ]; then
echo "can not continue"
echo "Missing DatabinID"
exit 1
fi

if [ -z $2 ]; then
echo "invalid invocation"
echo "Missing key"
exit 1
fi

BID_ID=`grep -E "^${BID_NAME}\\ " /etc/drop_data.conf | xargs | cut -d' ' -f2`
if [ -f /etc/drop_data.conf ]; then
BID_ID=`grep -E "^${BID_NAME}\\ " /etc/drop_data.conf | xargs | cut -d' ' -f2`
fi

if [ -z $BID_ID ]; then
BID=$BID_NAME;
Expand All @@ -46,7 +49,7 @@ if [ $2 != "--send" ]; then
exit
fi

if wget --help | grep -q secure; then
if $WGET --help | grep -q secure; then
DDURL="https://datadrop.wolframcloud.com/api/v1.0/Add?bin=$BID"
else
DDURL="http://datadrop.wolframcloud.com/api/v1.0/Add?bin=$BID"
Expand Down Expand Up @@ -89,4 +92,4 @@ done

echo "Dropping data with $DDURL"
rm -rf $DROPDIR/$BID
wget -T 30 -t 5 $DDURL -q -O -
$WGET -T 30 -t 5 "$DDURL" -q -O -