Create cPanel Account Backups on Dropbox

Issue: cPanel / WHM server, requiring account backups to be created, copied to DropBox, and then created backups removed off the server. Each account backup should be in its own directory on Dropbox.

Solution: Dropbox Master Uploader provided on GitHub: and adapting script originally documented at:

SSH to server as root then:

cd src
cd Dropbox-Uploader-master

Give execution permission:

chmod +x

Run installer:


This is the first time you run this script, please follow the instructions:

  1. Open the following URL in your Browser, and log in using your account:
  2. Click on “Create App”, then select “Dropbox API app”
  3. Now go on with the configuration, choosing the app permissions and access restrictions to your DropBox folder
  4. Enter the “App Name” that you prefer (for example: SomeName-NoSpaces)

Click on the “Create App” button.

When your new App is successfully created, please click on the Generate button, under the ‘Generated access token’ section, then copy and paste the new access token, that will look something like:

App folder

– Access to a single folder created specifically for your app.



Now copy to /usr/bin

cp /usr/bin

Go to directory and test:

cd /usr/bin info

Output should look something like:

Name: John Doe
UID: dbid:CCAeXz5c-XUEp9g-TBbeQ3xxXXXyJe432tc
Email: [email protected]
Country: SE

We need a script that takes the backups and facilitates the transfer.

Let’s make a file:

touch back2dropbox

and create the script:

nano back2dropbox
for fn in $1; do
/scripts/pkgacct $fn
/usr/bin/ mkdir /cpanel-backup/backup-$fn
/usr/bin/ upload /home/cpmove-$fn.tar.gz /cpanel-backup/backup-$fn/cpmove-$fn.tar.gz
rm /home/cpmove-$fn.tar.gz

Give execution permission:

chmod +x back2dropbox

Test one backup:

back2dropbox 'accountname'

Now try more than one:

back2dropbox 'accountname1 accountname2'

Now that it works, set a cronjob for daily backups:

crontab -e
0 0 * * * /usr/bin/backup2db 'accountname1 accountname2 accountname3' > /dev/null 2>&1

Source file (in case it’s removed from GitHub): Dropbox-Uploader-master

Leave a comment