Browse Source

fix dropbox upload

master
Christian Rotzoll 6 years ago
parent
commit
fc56b4ddf0
  1. 10
      home.admin/config.scripts/dropbox.upload.sh

10
home.admin/config.scripts/dropbox.upload.sh

@ -52,16 +52,16 @@ elif [ "${MODE}" == "upload" ]; then
DEVICE=$(echo $DEVICE | awk '{print tolower($0)}' | sed -e 's/ /-/g')
BACKUPFOLDER=.lndbackup-$DEVICE
curl -s -X POST https://content.dropboxapi.com/2/files/upload \
sudo curl -s -X POST https://content.dropboxapi.com/2/files/upload \
--header "Authorization: Bearer "${DROPBOX_APITOKEN}"" \
--header "Dropbox-API-Arg: {\"path\": \"/"$BACKUPFOLDER"/"$1"\",\"mode\": \"overwrite\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}" \
--header "Content-Type: application/octet-stream" \
--data-binary @$1 > /home/admin/.dropbox.tmp
safeResponse=$(sed 's/[^a-zA-Z0-9 ]//g' /home/admin/.dropbox.tmp)
#sudo shred /home/admin/.dropbox.tmp
#sudo rm /home/admin/.dropbox.tmp 2>/dev/null
UPLOADTIME=$(echo $FINISH | jq -r .server_modified)
if [ ! -z $UPLOADTIME ] ; then
success=$(echo "${safeResponse}" | grep -c 'servermodified')
sudo shred /home/admin/.dropbox.tmp
sudo rm /home/admin/.dropbox.tmp 2>/dev/null
if [ ${success} -gt 0 ] ; then
echo "# Successfully uploaded!"
echo "upload=1"
else

Loading…
Cancel
Save