Pat Pawlowski

PHP Script to download Sugar backups from the pbs_Backups module

Discussion created by Pat Pawlowski on Jun 26, 2017
Latest reply on Jun 29, 2017 by Pat Pawlowski

I don't know about everyone else but when I need to download a Sugar backup it's usually to a headless Linux machine and not to a machine with a UI and a browser. I created this script for just that.

You can download the gist from here or just run

curl > sugarbackupdownload

Make it executable:

chmod +xxx sugarbackupdownload 

And then run it:

php sugarbackupdownload
Enter base URL. ex:>
Enter username:> Ticomix
Enter password:> SomePassword

Connecting to Sugar and getting list of backups . . . 

0 - 7821ent 2017-06-26T00:26:33+00:00
1 - 7820ent 2017-05-02T20:50:31+00:00

Enter the number of the backup to download:> 0

Connecting to xxxxxxxxxx|:443... connected.

HTTP request sent, awaiting response... 200 OK
Length: 59485709 (57M) [binary/octet-stream]
Saving to: `'

100%[====================================================================================================================>] 59,485,709 18.6M/s in 3.0s

2017-06-26 10:02:54 (18.6 MB/s) - `' saved [59485709/59485709]


And that's all there is to it. You should now have the backup sitting wherever it was you ran the script. 


If anyone has a better way to do this or any way to enhance this script please speak up. Maybe I missed something very simple like curl or wget but I think the oauth login prevents just using those alone.