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

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

  1. Offline

    Meldanor

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

    http://forums.bukkit.org/threads/admn-backup-v1-8-3-a-simple-backup-plugin-1392.39927/

    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.

    Features:
    • 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
    Download:
    Source
    Plugin

    Changelog:
    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

    Install
    Just place it in your plugins dir

    Configuration
    Show Spoiler

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

    Version=1.6
    // --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!
    BackupIntervall=15
    // How many backups are retained? If this limit is hit, the oldest backup will be removed. (#)
    MaximumBackups=96
    // Only allow Ops to preform manual backups? (true/false)
    OnlyOps=true
    // 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)
    BackupOnlyWithPlayer=true
    // 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
    DontBackupWorlds=
    // 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)
    ZIPBackup=true
    // 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)
    CustomDateFormat=%1$td%1$tm%1$tY-%1$tH%1$tM%1$tS
    // 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)
    EnableAutoSave=true
    // Backup plugin directory? (true/false)
    BackupPluginDIR=true
    // Location of backups
    BackupDir=backups
    // Store all backuped world in one zip? (true/false)
    // If false every worlds backup is saved in one directory named in the format:
    // WORLDNAME_TIMESTAMP
    SummarizeBackupContent=true

    After this just type in your server
    /reload
    to reload the settings


    Permissions
    backup.canbackup

    Commands
    /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

    Roujo

    I'll go try that right away, thanks! =D
     
  3. Offline

    Legalec

    Great work !
     
  4. Thanks that worked! Now backing-up both my worlds!!
     
  5. Offline

    Meldanor

    Thanks for the solution, I will implement a bug fix for this. Thanks to you, this will shorten everything!
     
  6. Offline

    EnzoFX

    Thanks for the continued work on this! Can't wait for the upcoming features/fixes.
     
  7. Offline

    adam111316

    Would it be possible to get this to backup the plugins folder as well? It would be good because I have stats/achievements plugins, and I would like them to rollback as well if I rollback my worlds.
     
  8. Offline

    iBstoneyDave

    Been getting this error since first plugin use and it has persisted up to CB 670, any help would be appreciated.

    Code:
    03:09:16 [INFO] Start backup
    03:09:16 [INFO] Disabling level saving..
    03:09:16 [INFO] ConsoleCommandSender: Disabling level saving..
    03:09:24 [INFO] java.io.IOException: Error copying the Directory!
    nether
    C:\MC Server
    backups\nether
    03:09:24 [INFO]         at io.DiscManagement.copyDirectory(DiscManagement.java:6
    3)
    03:09:24 [INFO]         at backup.BackupTask.backup(BackupTask.java:85)
    03:09:24 [INFO]         at backup.BackupTask.run(BackupTask.java:57)
    03:09:24 [INFO]         at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainT
    hreadHeartbeat(CraftScheduler.java:122)
    03:09:24 [INFO]         at net.minecraft.server.MinecraftServer.h(MinecraftServe
    r.java:356)
    03:09:24 [INFO]         at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:283)
    03:09:24 [INFO]         at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:375)
    03:09:24 [INFO] Enabling level saving..
    03:09:24 [INFO] ConsoleCommandSender: Enabling level saving..
    03:09:24 [INFO] Finished backup
    
     
  9. Offline

    Meldanor

    So, i fixed the thing, it was really annoying, sometime I wanted just to give up ^^

    Version 1.2b is released:
    • Fixed bug with empty folders
     
  10. Offline

    blutherz

    Please give me the dowload link? the one in the topic gives me always 1.2a
     
  11. Offline

    Meldanor

    Delete you intercache, I've tried the download link a few seconds before and it worked.
     
  12. Offline

    d3rfu5

    Hi, this looks like a realy good plugin but I have a question:
    If for example I save my world every 30mn for 10 times, will it still backup my world by replacing the existing files after those 10 times?
     
  13. Offline

    NekoMikan

    "MaximumBackups=1440"
    in minutes or numbers of backups?
     
  14. Offline

    Meldanor

    Numers

    Yes, it will delete the oldest files
     
  15. Offline

    Zirdelan

    Thank you for writing this. I've been manually backing up using shell scripts but without control over world auto-saves i've never been 100% comfortable with that. I have one small request, could you add a config option to put all the world saves in the one file.

    i.e. rather than having
    worldA9042011-093659.zip
    worldB9042011-093646.zip
    etc
    you have
    9042011-093646.zip
    with each world in a different folder of the zip file.

    The reason I ask is that WorldEdit can restore regions from backups and it will cope with multiple world folders in the same zip file, however if you have per-world zip files then you need to manually specify the filename of the world you wish to restore.

    Thanks
     
  16. Has the issue been solved for when the world(s) get saved, major lag accords?
     
  17. Offline

    Meldanor

    No, this wasn't solved. But I try some things hopefully getting this solved.
     
  18. Offline

    Willobe

    So i did the fix, putting a random file into empty folders, for the back up.. it worked fine and everything but now with the new 1.2b
    i get
    Code:
    2011-04-09 15:29:45 [INFO] Start backup
    2011-04-09 15:29:45 [INFO] Disabling level saving..
    2011-04-09 15:29:45 [INFO] ConsoleCommandSender: Disabling level saving..
    2011-04-09 15:29:45 [SEVERE] java.io.IOException: The handle is invalid
    2011-04-09 15:29:45 [SEVERE]     at java.io.RandomAccessFile.seek(Native Method)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.RegionFile.a(SourceFile:342)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.RegionFile.a(SourceFile:279)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.ChunkBuffer.close(SourceFile:259)
    2011-04-09 15:29:46 [SEVERE]     at java.util.zip.DeflaterOutputStream.close(Unknown Source)
    2011-04-09 15:29:46 [SEVERE]     at java.io.FilterOutputStream.close(Unknown Source)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.ChunkRegionLoader.a(SourceFile:64)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.ChunkProviderServer.b(ChunkProviderServer.java:163)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.ChunkProviderServer.a(ChunkProviderServer.java:193)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.World.a(World.java:135)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.World.h(World.java:1401)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:359)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:283)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
    2011-04-09 15:29:46 [INFO] [SimpleSave] Beginning world save
    2011-04-09 15:29:46 [SEVERE] java.io.IOException: The handle is invalid
    2011-04-09 15:29:46 [SEVERE]     at java.io.RandomAccessFile.seek(Native Method)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.RegionFile.a(SourceFile:342)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.RegionFile.a(SourceFile:279)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.ChunkBuffer.close(SourceFile:259)
    2011-04-09 15:29:46 [SEVERE]     at java.util.zip.DeflaterOutputStream.close(Unknown Source)
    2011-04-09 15:29:46 [SEVERE]     at java.io.FilterOutputStream.close(Unknown Source)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.ChunkRegionLoader.a(SourceFile:64)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.ChunkProviderServer.b(ChunkProviderServer.java:163)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.ChunkProviderServer.a(ChunkProviderServer.java:193)
    2011-04-09 15:29:46 [SEVERE]     at org.bukkit.craftbukkit.CraftWorld.save(CraftWorld.java:543)
    2011-04-09 15:29:46 [SEVERE]     at backup.BackupTask.backup(BackupTask.java:85)
    2011-04-09 15:29:46 [SEVERE]     at backup.BackupTask.run(BackupTask.java:59)
    2011-04-09 15:29:46 [SEVERE]     at org.bukkit.craftbukkit.scheduler.CraftWorker.run(CraftWorker.java:33)
    2011-04-09 15:29:46 [SEVERE]     at java.lang.Thread.run(Unknown Source)
    2011-04-09 15:29:46 [SEVERE] java.io.IOException: The handle is invalid
    2011-04-09 15:29:46 [SEVERE]     at java.io.RandomAccessFile.seek(Native Method)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.RegionFile.a(SourceFile:342)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.RegionFile.a(SourceFile:279)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.ChunkBuffer.close(SourceFile:259)
    2011-04-09 15:29:46 [SEVERE]     at java.util.zip.DeflaterOutputStream.close(Unknown Source)
    2011-04-09 15:29:46 [SEVERE]     at java.io.FilterOutputStream.close(Unknown Source)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.ChunkRegionLoader.a(SourceFile:64)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.ChunkProviderServer.b(ChunkProviderServer.java:163)
    2011-04-09 15:29:46 [SEVERE]     at net.minecraft.server.ChunkProviderServer.a(ChunkProviderServer.java:193)
    2011-04-09 15:29:46 [SEVERE]     at org.bukkit.craftbukkit.CraftWorld.save(CraftWorld.java:543)
    2011-04-09 15:29:46 [SEVERE]     at backup.BackupTask.backup(BackupTask.java:85)
    2011-04-09 15:29:46 [SEVERE]     at backup.BackupTask.run(BackupTask.java:59)
    2011-04-09 15:29:46 [SEVERE]     at org.bukkit.craftbukkit.scheduler.CraftWorker.run(CraftWorker.java:33)
    2011-04-09 15:29:46 [SEVERE]     at java.lang.Thread.run(Unknown Source)
    2011-04-09 15:29:47 [INFO] [SimpleSave] Ending world save
    2011-04-09 15:29:58 [INFO] Enabling level saving..
    2011-04-09 15:29:58 [INFO] ConsoleCommandSender: Enabling level saving..
    2011-04-09 15:29:58 [INFO] Finished backup
    i have a handful of backups already as i just installed it the other day, but now no luck.. is it something i messed up?
     
  19. Offline

    Meldanor

    I've uploaded a new 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
    IMPORTANT

    You have to delete your config file, because I've added a new property!
     
  20. Offline

    Apoc_8bit

    Thanks for the update! I was just thinking though, wouldn't it make more sense to have it only perform a backup if there were no players online since the last backup? That way if someone has a long BackupInterval set, it will still backup the changes made before the last player logs off.

    For example here, the changes between t=16 and t=49 don't get saved because no one was online when the backup runs at t=60.

    backupinterval=60

    t=0, 1 player online and backup runs
    t=16, 1 player online; builds a lot of stuff
    t=49, player logs; 0 players online
    t=60, backup doesn't run since no players are online
    t=61, something bad happens; map gets corrupt
     
  21. Offline

    Meldanor

    So what you mean is a "last" backup when the last player logged out? Yeah, that can I implement.
    I will also set a delay between the Logout and the backup, because maybe a player want to relog.

    I will implement this in a further version.
     
  22. Offline

    Apoc_8bit

    Not exactly start a backup when the last player logs. When it's time for backup, if no one is online check if there was a logout since the last run backup. If yes, then run backup, if no, then don't. That way it always runs at the same interval.
     
  23. Offline

    Pasukaru

    Really nice plugin! :)
    But you made a small mistake here:
    Well - 1440 Backups with an intervall 0f 15 minutes is enough for 15 days, not 24 hours ;)
    1440 * 15 = 21600 minutes (=360 hrs, 15 days)
     
  24. Offline

    Meldanor

    Yeah, I have calculated wrong, I calculated 15*4*24 , but I have only to calculate 4*24 ^^

    But I've uploaded a newer version 1.3a which implemented the feature to start a backup from the console!
     
  25. Offline

    Boof

    Hi, I run dedicated server. I downlaoded your backup plugin a while back and i was impressed with its versatility and usefulness.

    However, I have encountered an unusual bug with several of my users. On occasion, during the backup time, some players will see a large "black hole" that resembles a larger chunk error. When the player steps into this black hole, they die immediately and lose all their inventory. At the same tiem of these occurances, broken or thrown objects/blocks seem to glitch. They fall, reset, then fall again repeatedly and cannot be picked up. I hope that you can find a way to target and address this issue since it is a problem that I cannot accept onto my server.

    Thanks for taking the time to make you excellent plugin and read my bug-report,
    ~Boof
     
  26. Offline

    Delois

    Would like to request that you can remove worlds to be backup'ed. We have a few archive worlds from previous events that are there as 'show' only. Since they can not edit the world, I dont need it backed up. Especially since those worlds have a large save file.​
     
  27. Offline

    MadManMarkAu

    Great plugin, but I have one qualm.

    You're using Scheduler.scheduleSyncRepeatingTask() to schedule backups. The only problem with using this method is the task runs in the same thread as the server. Thus, server will lock up while backups are running. When you have worlds that add up to 1Gb of data, this will cause the server to stop responding for a long time, disconnecting clients.

    I can see two solutions to this problem, both requiring investigation.

    One, you could use Scheduler.scheduleAsyncRepeatingTask() to run as a separate thread. But then you might have problems passing the save-off command to the server.

    Two, you can pass the save-off command in a Sync task as you are now, then spawn another thread to do the actual backup. A SyncRepeatingTask can check if the backup is complete every few server ticks, then execute save-on and cancel the task. Also need to flag if a backup is currently running or not.

    As I said, great plugin :)

    EDIT: Did some testing, using scheduleAsyncRepeatingTask() works flawlessly. You can send server commands and Bukkit will martial them itself. This is a perfect solution to the problem :)
     
  28. Offline

    Syntaxlb

    Hi,
    nice plugin, but can we change the broadcast message before an update ?
     
  29. Offline

    overlordror

    I too would like it if you add the broadcast message to the configuration file so that it can be changed, colored, etc.
     
  30. Offline

    JacKlink01

    Great Plugin. We have a Nether and a normal World. I would like to only backup the World and not the nether to reduce lag while backing up. Please add this option =D.

    Due to the way WorldEdit accesses the files in the backups folder, It would be nice if the custom folder did not exist and the custom backups went directly in with the others.

    I would also love to make custom broadcasts to be displayed during the backup.

    There's my two cents. :D
     
  31. Offline

    MarchingSpartan

    It would be awesome if you added an option to zip or not. The world files are already compressed and zipping them doesn't really save any space. This would also eliminate the need to have gzip for WorldEdit since world edit will use regular folders as well.

    Great stuff otherwise.
     

Share This Page