Forked from ivangayton/kobo-docker_to_digital_ocean_spaces.sh
Created
April 29, 2022 18:07
-
-
Save Hemanthdev/77c2d0d7b2325d2fe981df3bcf9bab78 to your computer and use it in GitHub Desktop.
Revisions
-
ivangayton created this gist
Aug 15, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ #!/bin/bash # From a cloud instance of Kobo-Docker, pull all of the attachments # and place them in a (much cheaper) Spaces filebin. # Assumes a Kobo-Docker instance running on a DO Ubuntu 16.04 instance # Need Amazon's CLI utility to manage transfers to/from spaces sudo apt install s3cmd # Add a key for the server in question to access your Spaces account: # https://www.digitalocean.com/docs/spaces/how-to/administrative-access/ # copy the key and secret token, and run (on the cloud server): s3cmd --configure # https://www.digitalocean.com/docs/spaces/resources/s3cmd/ # then you have to edit the config file at ~.s3cfg nano .s3cfg # Change host_base to appropriate example: nyc3.digitaloceanspaces.com # and host_bucket example: %(bucket)s.nyc3.digitaloceanspaces.com #Navigate to the folder containing the files cd kobo-docker/.vols/kobocat_media_uploads/$USER/attachments/ # Run GNU Screen so that you can close your terminal window without # stopping all of the transfers in a moment screen # start the transfers for i in $(find . -name *.jpg); do s3cmd put $i s3://ivan-filebin/FOLDER/; done; # You can then shut down that terminal and it will continue working (because of Screen) # later, go back into the server and launch a permission change to make the images public nohup s3cmd setacl s3://ivan-filebin/FOLDER --acl-public --recursive & # Again, you can shut down your terminal without interrupting the process (because of nohup) # and you can see the progress by doing tail -f nohup.out