From d60bc1855d9385a4540270a9ad976c63292803a8 Mon Sep 17 00:00:00 2001 From: flipphillips Date: Wed, 21 Sep 2016 21:15:36 -0400 Subject: [PATCH 1/3] Checks for existence of conf file before grepping it --- drop_data.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drop_data.sh b/drop_data.sh index ef28cf4..d455585 100755 --- a/drop_data.sh +++ b/drop_data.sh @@ -27,7 +27,9 @@ if [ -z $2 ]; then 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; From a8d983b6f423edadbc65cd2fd5bb7b4e9a3ada34 Mon Sep 17 00:00:00 2001 From: flipphillips Date: Sun, 25 Sep 2016 21:39:39 -0400 Subject: [PATCH 2/3] Quotes around the URL to wget to make it work w/ data w/ spaces & other non happy characters --- drop_data.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drop_data.sh b/drop_data.sh index d455585..eef1106 100755 --- a/drop_data.sh +++ b/drop_data.sh @@ -12,6 +12,7 @@ # avg - send average # no value: send latest value +WGET=/usr/local/bin/wget DROPDIR="/tmp/drop_data" mkdir $DROPDIR 2> /dev/null @@ -48,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" @@ -91,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 - From b54c2894ed701011f78484f8539e653187d740cf Mon Sep 17 00:00:00 2001 From: flipphillips Date: Mon, 3 Oct 2016 21:01:23 -0400 Subject: [PATCH 3/3] temp files are by-uid now. cleaned up a few error messages --- drop_data.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drop_data.sh b/drop_data.sh index eef1106..9be2987 100755 --- a/drop_data.sh +++ b/drop_data.sh @@ -14,17 +14,17 @@ 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