andreafabrizi / Dropbox-Uploader

Dropbox Uploader is a BASH script which can be used to upload, download, list or delete files from Dropbox, an online file sharing, synchronization and backup service.
https://www.andreafabrizi.it/2016/01/01/Dropbox-Uploader/
GNU General Public License v3.0
6.56k stars 1.08k forks source link

DB Uploader w/Radioplay Fails to Upload with Cron #118

Closed jj358mhz closed 10 years ago

jj358mhz commented 10 years ago

Hi Andrea,

I am using a program called Darkice to record and stream police scanner audio to Broadcastify. Integrated in Darkice is an app called Radioplay. I use Radioplay to archive trimmed (silence removed) .mp3 recordings every hour.

I installed DB Uploader in the hopes of having it upload a new .mp3 at the top of the hour to my Dropbox folder. I am able to successfully upload via a manual command (pi@raspberrypi ~/Dropbox-Uploader $ /home/pi/Dropbox-Uploader/dropbox_uploader.sh upload /home/pi/scanneraudio/2014-02-24-Mon-2215_trimmed.mp3 /scanneraudio/2014-02-24-Mon-2215_trimmed.mp3

Uploading "/home/pi/scanneraudio/2014-02-24-Mon-2215_trimmed.mp3" to "/scanneraudio/2014-02-24-Mon-2215_trimmed.mp3"... DONE)

When I try with a sudo radioplay cron, I get a failure (HTTP/1.1 100 Continue HTTP/1.1 401 Unauthorized Server: nginx Date: Wed, 26 Feb 2014 02:28:04 GMT Content-Type: application/json Transfer-Encoding: chunked Connection: keep-alive WWW-Authenticate: OAuth realm="https://api.dropbox.com/")

I do not understand why the manual upload operation works but the automated cron operation fails.

andreafabrizi commented 10 years ago

When you run the script with sudo (so with a different user), it uses a different configuration file. So, try to run the script manually using sudo and do again the configuration.

dustise commented 10 years ago

you should use the '-f' switch to execute the script in crontab

algzed commented 10 years ago

Thanks for the answer but i´m total new on this could you explain the usage of the -f switch if u use in the command line /var/www/teste/dropbox_uploader.sh -f /root/.dropbox_uploader upload "/var/www/algzed/mirja.html /public/logos_tv" it keep askink tto register as it is the first run time of the script

Would it be asking to much if you could give an example how to put inside the script type of

!/bin/bash

# /var/www/teste/dropbox_uploader.sh -f /root/.dropbox_uploader upload "/var/www/algzed/mirja.html /public/logos_tv"

Thanks

andreafabrizi commented 10 years ago

Hello @algzed, just run: /var/www/teste/dropbox_uploader.sh -f /root/.dropbox_uploader The fist time you will be asked to setup the configuration. After it will works. Of course if you are putting the configuration file in the root home directory, you need to run the script with the root user, otherwise you don't have the permissions...

algzed commented 10 years ago

Thanks a million. Understood and working 100%.