[INACTIVE][ADMN] Backup 1.6 - A simple Backup Plugin [818]

Discussion in 'Inactive/Unsupported Plugins' started by Meldanor, Mar 25, 2011.

  1. Offline


    I've stopped the development of this plugin, becase I lost the motivation. The user 'gamerx93' will continue my work in this thread:


    Backup - A simple Backup Plugin :
    Version : 1.6

    After I've searched for a simple, but powerfull backup plugin, I've tried some backups, but some have bugs, other don't save the world before they zip and so on. So I decided to write my own backup plugin.

    • Automatically backups the server(all worlds) in a Intervall you've decided and zip it.
    • Saves every world running on the server and every player before the backup
    • Supporting Permission
    • Supporting manuel backups (you can use an ingame command or on the console)
    • Storing only a limit of backups that you've configure
    • You can set that only to backup when player are on the server
    • Stores also the plugin folder
    • Formate the date format

    Version 1.6:
    • Added option to control where the backups are getting stored
    • Fixed disabling broadcast messages
    • You can now use also the old save system, which is the same as before 1.5
    • Uses godsny's suggestion for the config file. Thanks !
    • Fixed bug deleting the custom dir when the maximum backup limit is hit!
    • Fixed bug stopping the complete backup if there is one file error!
    • Fixed bug not disabling the automatic backup when you set the BackupIntervall to -1
    Version 1.5:
    • Added property to also backup the plugin folder(is set to true by default)
    • Fixed issue with data corruption by using not thread save methods. Thanks to desmin88 for the hints!
    • All worlds(and when enabled the plugin folder) is stored in ONE ZIP
    • Customize the timestamp by merge a fork of xfxian . Thanks to xfxian!
    • You can now disable enabling the autosave (the command "save-on", not the backup cyclus!) by setting the property to true. It is false by default. Notify, that I will run the command "save-off" before I will start the backup to prevent unwished results!
    • When server is starting, the config.ini is checked now. If you don't have the current config.ini you can see on the console a error. Remove / relocate the config temporary to get the newest one.
    Show Spoiler

    Version 1.4a:
    • Fixed the bug " [Backup] Zipping backup is disabled! "
    Version 1.4:
    • Use ASyncMethod instead of SyncMethod (the lags should be gone)
    • Own broadcast messages ( change the message in you config.ini file)
    • A backup is run when the last player has left the server after the normal backup cyclus.
    • Remove worlds from backup (add the names of the worlds in your config.ini files)
    • Add an option to just store the worlds in dirs or zip them
    • Some minor improvements
    Version 1.3a:
    • You can now run a backup from the console using the command backup
    Version 1.3:
    • Implemented new function to only backup when player are online
    • Use Apache Common IO library instead of code from the internet for a better performance and better stability
    Version 1.2b:
    • Fixed bug with empty dirs
    Version 1.2a:
    • Fixed bug not creating config.ini
    Version 1.2:
    • Implement property so only ops can start manuell backups
    • Updated to recommened build 602
    • Tried to fix the problem with some system by using the system file seperator
    Version 1.1:
    • Added option to give manual backups a name(which will never automatically removed by auto backup)
    Version 1.0:
    • First release

    Just place it in your plugins dir

    Show Spoiler

    After the first start of the plugin it generates a config.ini in "plugins/Backup".
    Here is the current content:

    // --All variables are in minutes--
    // How often show the backup run? (#)
    // Notice: -1 Will disable automatic backups. You have to run the backups now manually!
    // How many backups are retained? If this limit is hit, the oldest backup will be removed. (#)
    // Only allow Ops to preform manual backups? (true/false)
    // Should backups only be preformed when there are players on the server?
    // Notice: When the last player leaves the server, a final backup will be made
    // within the backup cycle. The automatic backup cycle will resume when a player
    // joins. (true/false)
    // Server broadcast message when starting a backup.
    // Notice : Remove the messages(not the property) to disable a broadcast. (text)
    MessageStartBackup=Start backup
    // Server broadcast message when a backup is completed.
    // Notice : Remove the messages(not the property) to disable a broadcast. (text)
    MessageFinishBackup=Finished backup
    // Worlds that should not be archived by the server, seperate them by
    // a semicolon. (directory names)
    // Example : World1;World2;Nether
    // ZIP backups?
    // If enabled, backups will be compressed and stored in a ZIP archive named with
    // the current timestamp.
    // If disabled, the backup will stored in a folder with the timestamp. (true/false)
    // Custom date format string that is appended to every backup.
    // If left empty, the default date format is used.
    // This has to be a Java String.format string, see
    // http://download.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html#syntax
    // for reference.
    // Example: -%1$tY%1$tm%1$td-%1$tH%1$tM%1$tS (YYYYMMDD-HHMMSS: 20101201-011323) (conforms to ISO 8601)
    // Enables the auto-save function after the backup.
    // Notice: If you set this to false, this plugin will backup your worlds but not save
    // the data from the memory to your hard disc. If the server crashes between
    // backups, all work is lost. Disable if you use another plugin to save the world
    // to disk (EG: autosave). (true/false)
    // Backup plugin directory? (true/false)
    // Location of backups
    // Store all backuped world in one zip? (true/false)
    // If false every worlds backup is saved in one directory named in the format:

    After this just type in your server
    to reload the settings


    /backup starts a manuel Backup of your server. If you don't have permissions, everybody can run this command.
    /backup NAME starts a manuel Backup of your server. This backup is stored in backups/custom

    So far
    So Mel
  2. Offline


    Backups are stored in the server root directory in a folder named backups.

    Would it be possible to implement a "quiet mode" for this plugin? I really do love this backup solution, but if I could cut down the chatter this plugin causes in the command line down to Backup Starting and Backup Complete, that would be oh so lovely.
  3. Offline


    It is implemented in my development build by setting an empty line for the messages in the config.
    It uses the sheduler to create a own Thread for creating the backup. But it doesn't create a thread for copying and a thread to zip them.
  4. Offline


    This is a great plugin! The backups take around 10-15 sec on my large world, but it's worth it. Today my first griefer logged in, proceeded to burn everything burnable, then told me he did so. He got banned, and the world was rolled back to a save 20 minutes before he logged in. Thanks for this!

    However, I would like to suggest a feature. Would it be possible for this plugin to save a backup automatically when a first-time user logs in? This isn't as relevant of a feature on my server where first-time users are not able to build until a Moderator approves, but I'm sure it would be quite useful on other servers that aren't set up like this.
  5. Offline


    I've been wondering about the same thing, my server just recently went down because of the hard drive getting badly corrupted and the backups didn't do much help being stuck inside there.
  6. Offline


    Could you please implement an option to change the color of the message this plug-in sends?

    EDIT: Is there a way to hide the ConsoleCommandSender messages it sends?

    2011-05-06 18:23:16 [INFO] [Server] Backing up the world!
    2011-05-06 18:23:16 [INFO] Forcing save..
    2011-05-06 18:23:16 [INFO] ConsoleCommandSender: Forcing save..
    2011-05-06 18:23:16 [INFO] Saving chunks
    2011-05-06 18:23:16 [INFO] Save complete.
    2011-05-06 18:23:16 [INFO] ConsoleCommandSender: Save complete.
    2011-05-06 18:23:16 [INFO] Disabling level saving..
    2011-05-06 18:23:16 [INFO] ConsoleCommandSender: Disabling level saving..
    2011-05-06 18:23:18 [INFO] Enabling level saving..
    2011-05-06 18:23:18 [INFO] ConsoleCommandSender: Enabling level saving..
    2011-05-06 18:23:18 [INFO] [Server] Back up finished!
  7. Offline


    This is a nice plugin, thank you.

    I too am wondering both questions that Deadly_Paradox just asked.
  8. Offline


  9. Offline


    With you 'fix' of using Asynchronous, instead of Synchronous, wouldn't your plugin now be non-threadsafe?
    You can't call any method from another thread other than main, exception of "getblocktypeidat()", without chances of data corruption etc.
  10. Offline

    Adam McFarland

    Any chance of a feature to customize the name of the save file?
  11. Offline


    As the project is being developed with NetBeans, the most accessible way is to install NetBeans and just open the project file. You will need to fix some imports (Permissions and CraftBukkit), to do that you just need to download those jar's and reference them in the IDE. Then it's just a click on the build button and you get your fresh snapshot.

    The other option would be to build it manually with javac, but that might be complicated if you're new to Java.

    Hope that helps.
  12. Offline


    Another feature I will implement in my new version.

    Don't know what you mean.

    Yeah, there is a chance for an interaction between the threads, but my plugin works this like:
    The sheduler creates a thread and runs it every X minutes.
    The thread call the server to stop all savings to the hard disc by calling the server command "save-off". Before this, of course it saves all data from the memory to the hard disc.
    Then it copies all worlds to a temporary dir and zip them.
    I don't think there will be a data corruption, because I do not change any data, just make a copy.
    But you are right, when two backups are running at the same time, there can be a chance for data corruption, but then only the current backup may be corrupt and not the server.

    Implemented in development build.
    I don't know a way to disable this.
  13. Offline


    He means the mapping feature of that backup plugin. It was able to automatically render images via mcmap or c10t.
  14. Offline


    No, i will not implement this feature, because this doesn't belong to an backup system. I want to concentrate on a backup plugin, not a general plugin for all basic functions.
    So, I'm sorry, but at this time I do not see a reason to implement this.
  15. Offline


    Actually, your calling the save method of world, not just making a copy.
    Therefore, it can cause world corruption on the current world.
  16. Offline


    How bout an option for linux users to tar+gz the backups

    another possible feature would be FULL backup once per day and do incrementals throughout to reduce disk space.

    below is sample from script i was using, but i like the plugin better.. :)
    		mkdir -p $BKUP_PATH
    		if [ -e $MC_PATH/$WORLD_NAME ]
    			if [ $ONLINE -eq 1 ]
    				echo "Server running, warning players : backup in 10s."
    				screen -S $SCREEN_NAME -p 0 -X stuff "`printf "say Backing up the map in 10s\r"`"; sleep 10
    				screen -S $SCREEN_NAME -p 0 -X stuff "`printf "say Now backing up the map...\r"`"
    				echo "Issuing save-all command, wait 5s..."
    				screen -S $SCREEN_NAME -p 0 -X stuff "`printf "save-all\r"`"; sleep 10
    				echo "Issuing save-off command..."
    				screen -S $SCREEN_NAME -p 0 -X stuff "`printf "save-off\r"`"; sleep 1
    			cd $BKUP_PATH
                DATE=$(date +%Y-%m-%d-%Hh%M)
    			if test `date +%H` -eq 0 -o ! -f $BACKUP_FULL_LINK
    				# Make full backup, and remove old incrementals
                    # Remove incrementals older than $BKUP_DAYS_INCR
                    # Remove full archives older than $BKUP_DAYS_FULL
                    find ./$WORLD_NAME-*-incr.tgz -type f -mtime +$BKUP_DAYS_INCR -print > purgelist
                    find ./$WORLD_NAME-*-full.tgz -type f -mtime +$BKUP_DAYS_FULL -print >> purgelist
                    rm -f `cat purgelist`
                    rm -f purgelist
                    # Now make our full backup
                    pushd $MC_PATH
                    find $WORLD_NAME -type f -print > $BACKUP_FILES
                    tar -zcvf $BKUP_PATH/$FILENAME --files-from=$BACKUP_FILES
                    rm -f $BACKUP_FULL_LINK $BACKUP_INCR_LINK
                    ln -s $FILENAME $BACKUP_FULL_LINK
                    # Make incremental backup
                    pushd $MC_PATH
                    find $WORLD_NAME -newer $BACKUP_FULL_LINK -type f -print > $BACKUP_FILES
                    tar -zcvf $BKUP_PATH/$FILENAME --files-from=$BACKUP_FILES
                    rm -f $BACKUP_INCR_LINK
                    ln -s $FILENAME $BACKUP_INCR_LINK
                	tar -zxvf $BACKUP_INCR_LINK -C /tmp
                rm -f $BACKUP_FILES
    			if [ $ONLINE -eq 1 ]
    				echo "Issuing save-on command..."
    				screen -S $SCREEN_NAME -p 0 -X stuff "`printf "save-on\r"`"; sleep 1
    				screen -S $SCREEN_NAME -p 0 -X stuff "`printf "say Backup is done, have fun !\r"`"
    			echo "Backup process is over."
    			echo "The world \"$WORLD_NAME\" does not exist.";
  17. Offline



    I'm still not getting automatic MultiWorld Backups. I still have to do it manually. All plugins are listed here.
  18. Offline


    make please an update..
    I want to backup my plugin file
  19. Offline


    Hi guys,

    I'm having troubles to implement a better way for creating the ZIPs, so I can't say, when I can release it.
  20. getting an error every now and then.
    thought i'd paste it in here.

    2011-05-10 18:46:31 [SEVERE] java.io.IOException: Write error
    2011-05-10 18:46:31 [SEVERE]     at java.io.RandomAccessFile.write(Native Method)
    2011-05-10 18:46:31 [SEVERE]     at java.io.RandomAccessFile.writeInt(Unknown Source)
    2011-05-10 18:46:31 [SEVERE]     at net.minecraft.server.RegionFile.a(SourceFile:343)
    2011-05-10 18:46:31 [SEVERE]     at net.minecraft.server.RegionFile.a(SourceFile:279)
    2011-05-10 18:46:31 [SEVERE]     at net.minecraft.server.ChunkBuffer.close(SourceFile:259)
    2011-05-10 18:46:31 [SEVERE]     at java.util.zip.DeflaterOutputStream.close(Unknown Source)
    2011-05-10 18:46:31 [SEVERE]     at java.io.FilterOutputStream.close(Unknown Source)
    2011-05-10 18:46:31 [SEVERE]     at net.minecraft.server.ChunkRegionLoader.a(SourceFile:64)
    2011-05-10 18:46:31 [SEVERE]     at net.minecraft.server.ChunkProviderServer.saveChunk(ChunkProviderServer.java:160)
    2011-05-10 18:46:31 [SEVERE]     at net.minecraft.server.ChunkProviderServer.saveChunks(ChunkProviderServer.java:190)
    2011-05-10 18:46:31 [SEVERE]     at net.minecraft.server.World.save(World.java:148)
    2011-05-10 18:46:31 [SEVERE]     at net.minecraft.server.World.doTick(World.java:1463)
    2011-05-10 18:46:31 [SEVERE]     at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:363)
    2011-05-10 18:46:31 [SEVERE]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:287)
  21. Offline


    Feature suggestion: Make us able to choose where to put the backups
  22. Offline


    You're ignorance towards the fact your calling MULTIPLE non-threadsafe methods in an Asynchronous schedule that can and will cause data corruption, sometimes unrecoverable has caused me to report your thread. I use to do this, and have since fixed the issue. You yourself should have done the same, however you ignored my warnings and others as well. Even if it may cause lag, it's a necessary evil.
  23. Offline


    my users can deal with a minute of lag.. would rather be safe then have to deal with corruption..
  24. Offline


    I type /backup or /backup 05112011 and nothing happens. It just stares at me and does nothing. Help?
  25. Offline


    I'm sorry for ignoring your hints. Thanks to your for giving me the hint, I'm working on a solution for this very fastly. I will run a kind of preparing thread running running sycronized on the sheduler doing all the "un-thread-safe" work. When this is done, this thread will create an asyncronized thread coping the worlds (and the plugin folder ;) ) and zipping them.

    Your config file has which content?

    We are now at version 1.5. Thanks for all your hints and reports. This update is very important because it prevent eventually data corruption. So to all users: Load the new update!
    • Added property to also backup the plugin folder(is set to true by default)
    • Fixed issue with data corruption by using not thread save methods. Thanks to desmin88 for the hints!
    • All worlds(and when enabled the plugin folder) is stored in ONE ZIP
    • Customize the timestamp by merge a fork of xfxian . Thanks to xfxian!
    • You can now disable enabling the autosave (the command "save-on", not the backup cyclus!) by setting the property to true. It is false by default. Notify, that I will run the command "save-off" before I will start the backup to prevent unwished results!
    • When server is starting, the config.ini is checked now. If you don't have the current config.ini you can see on the console a error. Remove / relocate the config temporary to get the newest one.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 13, 2016
  26. Offline


  27. Offline


  28. Offline



    one thing:

    Could you instead of a .rar make a .zip without the version number (in this case 1.5)?
    Because CraftBukkitUpToDate also supports .zip files. (Not sure about a .rar)

  29. Offline


    Or tar.gz/bz2/xz :p then I could directly download it, because on the server I have no unzip :D

  30. Offline


    sudo apt-get install unzip
    sudo yum install unzip

    I agree though that .rar is not a good option, straight link to .jar is preferred, but zip will suffice.
  31. Offline


    My problem was fixed. I didn't add myself to the admin permissions.

Share This Page