Backup plugin with Dropbox chunkloader

Discussion in 'Archived: Plugin Requests' started by deimos161, Aug 17, 2013.

  1. Offline

    deimos161

  2. I'm going to be pretty happy when this is finally done. It'll be such a great tool for server owners :) The only reason I didn't take it on is because college apps are a pain in the a** and take up a lot of time :p
     
  3. Offline

    deimos161

    I guess Sgt_Tailor is no longer doing this. Such a shame. Looks like we will be looking a bit longer for something like this hey The Gaming Grunts :p
     
  4. Offline

    deimos161

    Bump, is anyone able to help out with this?
     
  5. Online

    timtower Moderator Moderator

    Backup entire server folder? Just zipping entire folder, zipping works btw.
    1 issue: some files can't be zipped when the server is running
     
  6. Offline

    deimos161

    timtower I still have a bandwidth problem :( So I am not able to download my files or anything.
     
  7. Online

    timtower Moderator Moderator

    Then I will stop working on this
     
  8. Offline

    deimos161

    timtower :p I didn't know you were working on it to begin with :p

    I'm not sure how, but MineBackup was able to zip world files and the plugin file, which is really the only ones that need to be zipped.
     
  9. Online

    timtower Moderator Moderator

    deimos161 This one is just zipping everything atm. Uploading isn't that easy though
     
  10. Offline

    Minecrell

    deimos161 likes this.
  11. Online

    timtower Moderator Moderator

    Already using it, but it isn't very well documented
     
    Garris0n, deimos161 and Minecrell like this.
  12. Offline

    Dunsuro

    Here's some code that may help, source: http://stackoverflow.com/questions/13180853/dropbox-chunkedupload
    Code:
    /** Uploads content to Dropbox.
    * @param dropbox An already linked dropbox API
    * @param stream The stream to upload
    * @param length The number of bytes to upload
    * @param path The path where to store the uploaded content
    * @return a boolean, false if the upload was cancelled, true if it completes
    * @throws IOException
    * @throws DropboxException
    */
    public static boolean upload(DropboxAPI<?> dropbox, InputStream stream,
            long length, String path) throws IOException, DropboxException {
        // Create a chunked uploader
        ChunkedUploader uploader = dropbox.getChunkedUploader(stream, length);
        try {
            int tryCounter = 1;
            while (!uploader.isComplete()) {
                try {
                    uploader.upload();
                } catch (DropboxException e) {
                    tryCounter++;
                    if (tryCounter > 5) throw e;
                    System.err.println ("Upload failed, trying again ...");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e1) {
                    }
                }
            }
        } catch (DropboxPartialFileException e) {
            // Upload was cancelled
            return false;
        }
        // If the upload completes, determine the current revision of the path.
        String parentRev = null;
        try {
            Entry metadata = dropbox.metadata(path, 1, null, false, null);
            parentRev = metadata.rev;
        } catch (DropboxServerException e) {
            // If the error is not a FileNotFound error => It's really an error
            if (e.error!=DropboxServerException._404_NOT_FOUND) throw e;
        }
        // Finish the upload
        uploader.finish(path, parentRev);
        return true;
    }
     
    deimos161 likes this.
  13. Online

    timtower Moderator Moderator

    Dunsuro Tried that already? Because I don't have a DropboxAPI class at all
     
  14. Offline

    thomas15v

  15. Online

    timtower Moderator Moderator

  16. Offline

    deimos161

    timtower Thank you for trying to make this buddy, I really am greatful :D
     
    timtower and thomas15v like this.
  17. Offline

    Dunsuro

  18. Online

    timtower Moderator Moderator

    deimos161 I have good news, bad news, and more good news.
    First good news: there is no bad news :p ( little joke )
    Second good news: Able to upload to dropbox, now starting on polishing it ( it uploads when you start the server now and it will stop the rest of the server till it is done )
     
    Garris0n likes this.
  19. timtower
    I have some free time now that I have some college apps out of the way. If you need any help with it, let me know :)
     
  20. Online

    timtower Moderator Moderator

    Don't need to but appreciate the offer ;)

    deimos161
    I am done! :D
    Couple things:
    1. Download is a zip with in it a plugins folder, guess you know what to do with that
    2. Open the folder of the plugin, run the Authenticate.bat, this will give the plugin permission to touch your dropbox ( if done correctly )
    3. Start your server.
    4. Perform /backup, this will start the backup process.
    5. This is an extremely slow plugin! If you stop the server when it is still running then the backup will be interrupted.
    6. This won't touch the server thread, so this won't freeze your server ( had this in the beginning )
    7. Permission to use this: backuplikemedb.use
    8. Download link ( pretty important ) : https://www.dropbox.com/s/3nsa9a55orelabi/BackupLikeMeDB.zip
    9. Bugs / errors? Let me know
    10. Last but not least: Have fun with it
     
  21. Offline

    deimos161


    SWEET!! Thanks so much dude.

    About to give it a go now.

    EDIT - Ok so Im having trouble,
    1, I can no run the .bat as I'm using a mac, so I tried the .jar but it wont open/load.
    2, I use a dedicated host (Not a home or VPS) so is there away to run the auth.bat/jar from the server.
    3, Does this plugin run periodically or just at server start?
     
  22. Online

    timtower Moderator Moderator

    1. You need to run the jar from any commandline thingy
    2. the jar will create a file "AUTHENTICATE", just copy that to the folder of the plugin on the server
    3. Only runs on command /backup
     
  23. Online

    timtower Moderator Moderator

    deimos161 Plugin working the way you want it?
     
  24. Offline

    deimos161

    timtower
    Sorry for the delay, I had a major car accident which took me out of action for a bit.
    Does the plugin work with 1.7 are you able to submit this to bukkit dev as well?
     
  25. Online

    timtower Moderator Moderator

    Hope you recovered okay.
    And I am, don't thrust the code?
     
  26. Offline

    deimos161

    timtower PFT I trust you, if its in bukkit then I can use bukitget through beastnode to update.
    And I am good, car is not >.<
     
  27. Online

    timtower Moderator Moderator

  28. Offline

    Maximvdw

    Btw, why dropbox :p. You only get like 2GB without referals. Personally I use "copy.com" you get 20 GB if you use a referal link of someone, and you get 5 GB for everyone you refer.
     
  29. Online

    timtower Moderator Moderator

    He payed for it
     
  30. Offline

    Maximvdw

    Well :p, I was thinking to do that aswell, until I found that site xD. Got like 140 GB now from my players clicking my referal link :). It even works the same way as dropbox. You get a map on your computer (mac,pc,linux) that syncs.
     

Share This Page