[ADMIN] Linux Init Script for Bukkit

Discussion in 'Bukkit Tools' started by Toasty, Jan 4, 2012.

Thread Status:
Not open for further replies.
  1. Offline


    Toasty Okay I understand, well I do hope you implement it soon I'm really missing it :p
  2. Offline


    beleg It's an I/O issue more than a raw performance issue. The only way to fix it via hardware would be to use an SSD for storage.

    Theoretically it might be possible to alleviate the issue with a second ramdisk that acts as a storage buffer. I.E. copy the live world files from the active ramdisk to the backup ramdisk, re-enable saving, then copy the data from the backup ramdisk to the disk in the background. Since the I/O ops would complete much more quickly between two ramdisks, your server would probably continue to run just fine (albeit with a short lag spike).

    Though that's just a thought, really. It increases the chance of data loss and rsync really is the better solution for large world files.

    At any rate, as I mentioned before rsync is at the top of the feature list.
  3. Offline


    I've implemented a preliminary fix for this issue, and it's available in the development branch. If running the stop command fails, just run it again a few seconds later and it should properly unload and unmount the ramdisk (for sure this time). Just grab the script from this link: https://github.com/Codeprogrammers/codecraft-init-script/zipball/develop

    Quite a bit has changed in the script though. All the configuration is done in a separate file which is stored in the /etc folder as it rightfully should.

    Fronix & beleg Should have rsync support here within the next two weeks. I won't promise anything since I've got a few other projects that just landed in my lap, but it looks like a definite possibility for the time-being.
  4. Offline


  5. Offline



    I don't know if the script is bugged but for some reason the ramdisk isnt on /mnt/ramdisk any more its loaded on /home/<uname>/servers/<myserver>/ramdisk and in there i can only find a map called worlds with a checksum.rar in it. And i also had to create a new directory called ramworlds? I'm very confused here, my server is starting to crash because of insufficient space, and I'm assuming that it means the ramdisk is getting full because it creates new directory backups IN the ramdisk but renaming them to the date,time and seconds.
  6. Offline


    Since you've got a new folder called "ramworlds" I'm going to assume you're using the development version I linked to previously.

    As I mentioned earlier, a lot has changed. Configuration is now done in a separate file stored in the /etc directory, so make sure to take a look at that and configure the script properly. The version you're using is basically alpha quality and hasn't been tested, so expect it to be buggy until we've had time to polish it up a bit and release a beta version.

    At any rate, the new folder, "ramworlds" is where you should store any worlds that you want to be loaded into the ramdisk. This enables you to only put specific worlds into the ramdisk, instead of being forced to put all of your worlds in the ramdisk. Don't worry about making symbolic links for anything as the script will now handle that for you.

    Make sure to put the path to your worlds folder in your bukkit.yml file under the "world-container:" option. If the option isn't there, just add it in somewhere under the "settings" section. For example, my bukkit.yml file has "world-container: /opt/codecraft/worlds" under the settings section.

    There's also a new setting in the config file. Previously, I had the script use tmpfs for the ramdisk and this wasn't configurable. Now (thanks to Paswaru) there's an option to use either ramfs or tmpfs. The difference being that tmpfs will only use the amount of RAM set in the "RD_SIZE" option, while ramfs will start out at that size and grow accordingly. If your ramdisk is running out of space, either increase the RD_SIZE option (for tmpfs), or use the ramfs option. Just keep in mind that ramfs doesn't have a limit on it's growth, so it could cause your whole system to run out of available RAM and freeze/crash.

    As for your issue with the ramdisk folder being in the wrong place, I tested out the script on my dev server and didn't have any issues, so it's probably due to an improper configuration or permissions issues. Make sure that the new config file is correct for your server, and that the user you're running bukkit under has ownership and r/w privileges to the proper directories.

    The documentation won't be updated until we push the code to a release branch, so you'll have to bear with it for now.
  7. Offline


    Toasty Okay I fixed my problem now. Thank you for replying so fast, im looking forward to the new releases.
  8. Offline


    Unless you have a reasonable amount of spare memory, tmpfs is by far the better choose between the two. tmpfs can be swapped to disk if your system starts becoming low on memory. Ramfs can't be swapped, so once your system runs out of memory, the kernel is going to be very unhappy to say the least. :D

    On the other hand, tmpfs is a fixed size device, so if your world files grow to fill up the drive. Java is going to throw an exception and CraftBukkit is going to be very unhappy.

    Either way, keep an eye on your system when using a ramdisk. I have an idea to check the free space/memory and if it gets critically low, having it stop CraftBukkit as a safe guard to both situations. I just need to find the time to write and test the code.
  9. Offline


    Toasty, okay we have had some real issues with the dev version. I'm not sure exactly if this really happens but players are saying that the world is rollbacking when the server is online (not sure that is even possible). And these ramdisk folders are really making me confused, and why a backup on worlds and ramdisk? What is the difference :O
  10. Offline


    There should be a folder called "ramdisk" that only appears while the server is running, if the ramdisk option is enabled.

    If you want a specific world to be loaded into the ramdisk, put it in the "ramworlds" folder. If you don't want a world taking up space in the ramdisk (a less heavily trafficked one, for example), just put it in the "worlds" folder.

    If the ramdisk option is not enabled, all worlds in both folders will still be loaded up, just not in a ramdisk (obviously).

    As for the backup options:

    'backup worlds' will back up all the worlds on your server, ramdisk or not.

    'backup ramdisk' basically takes a snapshot of the ramdisk at that point in time. Anything, worlds or otherwise, that may reside in the ramdisk will be backed up.

    I don't know why the worlds would roll back while the server was online. Seems like a bukkit/plugin issue, possible related to I/O. Could also be a permissions issue, or something related to configuration, or even a performance problem. I wouldn't be able to tell you much more than that without detailed information of your setup.
  11. Offline


    Ok major noob here so be warned....i think i followed the instructions to the point and when i started my init script with screen it sayed mounting ramdisk loading ramdisk and then the screen terminated...now i figured it didnt work but i can see that my minecraft is running. However im not sure im running on a ramdisk because when i stop my server everything gets saved ...even though i havent set up that cron thing yet. Another thing when i try to use ./minecraft rdbackup I get the message /etc/init.d/minecraft {start|stop|restart|status|worldbackup|rdbackup}
    . TLDR how can i be sure that my ramdisk is running properly

    PS. what is the lock file, im not really sure where i should make the directory to this go
  12. Offline


    Ok figured it most out minus the lockfile. Had a problem with ramdisk unmounting before it unloaded so i incresed the sleep time seemed to fix it for now. Also figured out the commands to backup (didnt realize they changed). however im not sure if this is intended or not but everytime i stop the server or backup it saves as a different name instead of overwriting the existing file this is a problem with my server as we have multiple maps and it adds up space fast, so i was wondering if there was a way to set the script up to overwrite or set up a seperate script to delete the old backups/saves to clear out space.
  13. Offline


    The script is still in development. We plan on having the script automatically cull backups according to adjustable parameters, but for now you'll have to delete unnecessary ones yourself.

    As far as backups are concerned, best practices often suggest you keep multiple ones, so don't delete them just because they're old. I'd suggest you keep at least the 5 previous backups. If your worlds are exceedingly large, you could get by with just the previous two backups.

    We've been having a couple of issues with the lockfile. What OS are you using? (i.e. Ubuntu/Debian or CentOS/RHEL)
  14. Offline



    and its not a problem so much as i dont know what it is/ where to point it

    Ah nvm seems there is a file by that name in that location not really sure how it got there but there is a minecraft file in /var so i guess its working...just not sure what it does

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


    Assuming your using the non-developmental release.
    Change line 65 from
  16. Offline


    i'm unable to run this script on a user without root privileges, the error message is: mount: must be superuser to use mount

    i've got this in /etc/fstab
    none    /mnt/minecraft/ramdisk  ramfs  user,noauto,ro      0 0
    can i get some help with this?
  17. Offline


    Only root users can mount and unmount file systems. This is a security feature built into most distributions of Linux. The script is designed to be called as a root user (as stated in step three of the setup guide). The bukkit/minecraft server process itself will be run as the user you specify in the config (not root), as will the screen session.

    You do NOT need to put the mount in fstab. In fact, there's a good chance that putting that in fstab will cause issues with the script (the script expects to be able to both mount and un-mount the ramdisk).
  18. Offline


    oh ok :) thanks for clearing this up, i didnt realize that it was made to be ran from root i just thought you ran it that way, hopefully this keeps others from making the same mistake.

    i appreciate your work on this, its been very helpful.
  19. Offline



    Okay the develop version doesn't work very well any more. I try to get only my /world/ map to be loaded into the ramdisk but instead all of my maps gets loaded in there.

    My folder setup:

    In ramworlds i have my /world/ map and its also in the /worlds/ folder but still all my maps get loaded into ramdisk.
  20. Offline


    We reverted that feature in the development branch (i.e. only load specific world into ramdisk using folders). I re-implemented that feature in the feature-ramworlds branch by cherry-picking some older commits.

    Also, just to give everyone a heads up, development is currently on hold again (and has been for a couple weeks now). I'll get back to this when I'm not busy.
    Fronix likes this.
  21. Offline


    Thank you, I really liked the option to choose what map to put it ramdisk. The only option now is rdiff backups and rsyncing :D
  22. Offline


    So the dev version is not working as intended, when making ramdisk backups via cronjobs it can just bug and make backups until the disk is full. I'm now using the rdiff-developer version and I think it's working, I have not tried to restore any backups yet but I'm going to try that later.
  23. Offline


    I personally would like to see more work done so that I can finally move from remote toolkit to another more professional script. Toolkit is great however I have 16gb of ram on my server system and It needs to be put to use :D
  24. Offline


    I just CAN'T handle this script. It's too complicated for me. :(
    I just want to setup Minecraft server (Bukkit) to run as a service on Debian. But in readme I see "ramdisk", I don't know what to do.
    I put craftbukkit.jar into "root/S1/" with all the folders like "plugins". I'm running it with 512MB of min and max heap. How to make a service with functions like above?
    • Start Minecraft/Bukkit server on system startup
    • Start and stop the service properly on runlevel change (Startup, Shutdown, Restart, etc.)
    • Backup command for worlds
    • Remote access to Minecraft/Bukkit console with Screen and SSH (I already have that... ._.)
    Please explain me this as for newbie. Server is on VPS, OpenVM, "screen" already installed. I didn't changed the name of the world and I don't want to do it in future.
Thread Status:
Not open for further replies.

Share This Page