diff --git a/drop_data.sh b/drop_data.sh index ef28cf4..9be2987 100755 --- a/drop_data.sh +++ b/drop_data.sh @@ -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; @@ -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" @@ -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 -