How to implement the automatic dropbox upload script to post the back-up file to the sites dropbox
Dropbox Uploader is a shell script that can be used to upload, download, delete, list files from Dropbox. It's written in BASH scripting language and only needs cURL.
Follow the below steps to create a automatic dropbox uploading script to keep you files secured and portable.
First, clone the repository using git (recommended):
git clone https://github.com/andreafabrizi/Dropbox-Uploader/
- Provide execution permission to the script
$chmod +x dropbox_uploader.sh
- Run the below command after providing the execution permissions
Follow the below steps to create the App for the dropbox account.
This is the first time you run this script.
- Open the following URL in your Browser, and log in using your account: https://www.dropbox.com/developers/apps
- Click on "Create App", then select "Dropbox API app"
- Select "Files and datastores"
- Now go on with the configuration, choosing the app permissions and access restrictions to your DropBox folder
- Enter the "App Name" that you prefer (e.g. MyUploader226172246319943) and click create app.
- Enter the App key, App secret and App folder Permission type.
- Now from the above you are given drop box upload permission for the your files and folders.
- To test your linking with drop box..Please check with the following commands:
./dropbox_uploader.sh upload /backup.tgz
./dropbox_uploader.sh delete /backup.zip
./dropbox_uploader.sh mkdir /myDir/
Next to add the automatic script to crontab. Crontab is actually a time table consisting of list of cron jobs.
- Command to list all cron jobs:
- Next to add new a new cron job or edit previous cronjobs
- Installed new cron job
0 2 * * * /dropbox_uploader.sh delete back-up-file.tgz; /dropbox_uploader.sh upload /latestbackup.tgz tbg-backup
The above cron time specifies the cron job should happens every day at 2 am.