[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

    Put your configuration on pastebin so I can take a look at it. If you're only getting partial transfers, then I'd have to assume it was a plugin causing the issues somehow.

    But to clarify, you're saying that changes to the terrain get saved, while buildings don't?
     
  2. Offline

    tom

    Hey thanks for the response, i managed to fix my error by chaning the world container in bukkit.yml

    Toasty

    root@ip:/etc/init.d# ./minecraft stop
    craftbukkit.jar is running... stopping.
    craftbukkit.jar could not be shut down... still running.
    Can't unload ramdisk, craftbukkit.jar is still running!
    Ramdisk mounted at /home/dfomain1/minecraft/servers/dfo1/minecraft_ramdisk.... unmounting
    Ramdisk unmounted

    And then it rolls back ???

    How did you solve this ?

    Toasty

    EDIT: I fixed the issue, i just added a larger sleep value in the shutdown script to allow more time for craftbukkit.jar to shutdown. Thanks KHobbits

    How do auto saves and backups work?

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

    SupaYoshi

    Okay im playing around alittle with your ramdisk script ;)

    Does this thing actually create a ramdisk ? Because I dont need that, I have setup a ramdisk on linux startup already, however it needs to copy the server directory to the ramdisk and launch craftbukkit ;) and run my world and plugins and some files in the ramdisk :) Please inform me.
     
  4. Offline

    GriffithMar

    Is there anyway you can add a forcestop value to the script? I seem to have a lot of crashes, and I'm not too good at writting code like this, but maybe implement someting like a SIGTERM into it?
     
  5. Offline

    beleg

    thanks for this, working nice :)
     
  6. Offline

    beleg

    I changed
    Code:
    as_user "screen -p 0 -S $SCREEN_NAME -X eval 'stuff \"stop\"\015'" ; sleep 8
    but its still not working..
     
  7. Offline

    Toasty

    Sorry for not keeping this up to date. I plan on putting in a little more time into this script every now and then. I'm currently trying to get a hold of the guy who worked on a forked version of the script so I can pull in some of his changes.

    In the mean time, I've created a page for the project on Github (aside from the main Github project page. It's like a landing page of sorts). You can find it here. However, there's nothing new or important yet.


    On a side note, this project was started with server admins in mind, and I never intended to cater to the needs of users who were just running a small server for some friends. To that extent, I never intended on answering many questions in regards to setup, but the script was (and still is) in a pre-release stage so I felt obligated to do so. However, I won't really have a lot of time to spend on the script as it is, so I won't be doing any more troubleshooting for people unless I think the problem could be caused by an issue in the script itself.

    Though you're all free to ask questions about the script in general. I don't have any problems with that. Bugs should be reported to the issue tracker on github though. If you reply to this thread regarding a bug I'll just ask you to report it on the tracker.

    Yeah, the sleep timer loop is just an interim solution. I'm not sure when I'll get around to pinning down the cause of the problem and implementing a proper fix though. I've got some other features that I want to add (rsync for incremental backups being the biggest one at the moment). I'll have a proper fix for it before 1.0 with any luck though.

    As for auto saving and backups, there still isn't any automation for that built into the script. All it will be though is a function to create a cron job. For now, it's best to just set up a cron job manually and have it execute 'service minecraft backup {worlds|ramdisk}' periodically. I've been putting off that part of the script because I want to have a proper cleaning function to go along with it. Something that will remove specific backups at the end of each week to keep the backups folder from getting too cluttered.

    In regards to the world data being rolled back, it seems to be an issue with the script not waiting long enough before executing the mcrd_unload function (which fails to complete as it detects the service still running). The main problem is with the mcrd_unmount function completing its execution even though the ramdisk hasn't yet been unloaded. I've added this problem to the issue tracker on github.

    As stated in the wiki, yes this script creates a ramdisk if you enable that option.

    Honestly, I would suggest that you just use the ramdisk feature that I've implemented in the script as it will un-load and unmount the ramdisk when the service is not running, freeing up resources for your server. The size of the ramdisk is of course also configurable in the script.

    If you choose to use my script in your configuration with the ramdisk feature disabled, make sure that the backup folder is located somewhere that isn't in the ramdisk. One of the main reasons I made this script in the first place was to make backups so I didn't lose too much data in the event that my system crashed while the server was loaded into a ramdisk.

    Also, there's really no need to load your plugins into a ramdisk. When the plugins are executed, they're loaded into RAM by the system. The only benefit that putting plugins into a ramdisk will give you is a faster start-up time when launching the server (which in almost every case is only a few seconds at most even with many plugins installed). And you'll only see that benefit if you always have your ramdisk mounted and loaded with your files, even when the minecraft server isn't running (which isn't safe, because if the server crashes or power gets cut to it, all the data in the ramdisk will be lost).

    If you're planning on using my script and you want to run your server in a ramdisk, you might as well just use the built-in functionality. It'll do everything you're already doing, only it won't keep the ramdisk mounted when the service isn't running (unless you run the restart command in the script), making it more efficient with your system's resources.

    I'll look into it. I might add it in as a separate force-stop command.

    Though also keep in mind that if the minecraft server freezes or crashes without ending the process, you can still open up the screen session (screen -r [screen name], the screen name is set in the config, make sure you're logged in as the user declared in the config) and press ctrl+c to force the process to terminate. If you're using the ramdisk feature, then just run 'service minecraft stop' afterwards and the script will unload and unmount the ramdisk safely.

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

    Paswaru


    I'll send the pull requests up as soon as I get home from work and can take the time to write proper comments. So in about 2 hours.


    EDIT: Pull request sent. Comments not so proper, got annoyed with GitHub not letting me break up each change I made. I'm old school, give me a diff patch any day.
     
    Toasty likes this.
  9. Offline

    levisn1

    I have 24gb server with xeon i7 and worlds about 5 gb...
    INVOCATION="java -Xms512M -Xmx14000M -jar craftbukkit.jar"
    RD_SIZE="8000m"
    this settings are good?
    and another important question....how to have auto save against crash???like when the server stop?...this is very important..
     
  10. Offline

    Toasty

    You should reduce the amount of RAM given to either the Java VM or the ramdisk. You should also expect the JVM to use a bit more RAM than what you give it. I'd suggest dropping the invocation to something like 12GB max, seeing as you have a fairly large map.

    As for automatic backups, as I've said before, you'll need to make a cron job for now. Automated backups will be built into the script in the near future.
     
  11. Offline

    levisn1

    So you think that 12 gb for java and 8 for ramdisk are good? :) im totally noob in things like this..
    can you write a simple tutorial for create a cron job?..thanks again..
     
  12. Offline

    Toasty

    12GB for Java and 8GB for the ramdisk sounds good to me. You should test the settings yourself and see how much RAM java actually utilizes, and then adjust accordingly. But 12GB is a good place to start.

    As for the cron job, I stated the following in an earlier post:
    Please don't take it personally, but setting up a cron job is very easy to do. Simply googling "How to create a cron job" will give you plenty of information on the subject. If you can't manage to set one up after that, then I might suggest that you do something else with your time instead of trying to run a minecraft server.
     
  13. Offline

    beleg

    1. open putty and connect to your server
    2. write (in putty) crontab -e
    3. add this: 0 */4 * * * /etc/init.d/minecraft backup ramdisk
    4. see how it makes an backup every 4 hours..
     
  14. Offline

    levisn1

    ahh good :) for every 6 hours is 0 */6 * * * /etc/init.d/minecraft backup ramdisk?

    I have already sometime this error why with 8gb for ramdisk and 12 to java... :( cant keep up..why? with
    50 players online and i7 xeon..

    21:08:58 [INFO] **PirateLOL [-UTENTE-] M H W mrponji: casa mi vendi un occhio diragno fermentato??
    21:08:58 [INFO] **Ultima [-VIP-] iAmSonx: si casa
    21:08:58 [INFO] *ICreaper [-VIP-] H M D ~casa88: triko stai veramente romperndo -.-'
    21:08:59 [INFO] [TopPVP]: Player Killed: Puffo
    21:09:00 [INFO] Puffo lost connection: disconnect.quitting
    21:09:00 [INFO] Connection reset
    21:09:00 [INFO] [PLAYER_COMMAND] LordFranzo24: /home
    21:09:01 [INFO] **ICreaper [-UTENTE-] D H M 000fiver: al massimo alleanze
    21:09:01 [INFO] [PLAYER_COMMAND] Marzio96: /warp ariaperta 5
    21:09:01 [INFO] FactionChat ManiacAtk: Francesca95: okXD
    21:09:01 [INFO] FactionChat ManiacAtk: Francesca95: okxd
    21:09:02 [INFO] Connection reset
    21:09:02 [INFO] Alien4 lost connection: disconnect.endOfStream
    21:09:03 [INFO] [-UTENTE-] Pepefigo1998: la voglio
    21:09:03 [WARNING] Can't keep up! Did the system time change, or is the server overloaded?
    21:09:04 [INFO] **King [-HELPER-] H M W ~Revolutiiionz: lalala
    21:09:04 [INFO] *Ultima [-VIP-] TheBoss_99: cazzo fate !!!!!!
    21:09:06 [INFO] Creating empty config: /root/codecraft/servers/b2149/plugins/Essentials/userdata/baluba007.yml
    21:09:06 [INFO] baluba007 [/93.32.184.178:45953] logged in with entity id 2387892 at ([world] -401.5, 97.62000000476837, 236.5)
    21:09:06 [INFO] [TopPVP]: Creating player baluba007
    21:09:06 [INFO] [-UTENTE-] Digger moltras: uffaa
    21:09:07 [INFO] [Factions v1.6.7] PierKinect left the faction: Assassini
    21:09:07 [INFO] [Factions v1.6.7] The faction Assassini (173) was disbanded due to the last player (PierKinect) leaving.
    21:09:07 [INFO] [PLAYER_COMMAND] PierKinect: /f leave
    21:09:07 [INFO] [PLAYER_COMMAND] ArmoredCore: /home
    21:09:08 [INFO] *ICreaper [-VIP-] H M D ~casa88: Sì mrponji
    21:09:08 [WARNING] Can't keep up! Did the system time change, or is the server overloaded?
    21:09:08 [INFO] *Ultima [-VIP-] TheBoss_99: minchia oh
    21:09:09 [INFO] RevengeXXX96 [/79.7.175.19:50066] logged in with entity id 2388452 at ([world] -404.0, 96.0, 234.0)
    21:09:09 [INFO] Alien4 [/79.55.100.65:26533] logged in with entity id 2388467 at ([world] -1285.906334462961, 68.0, -120.97428115701398)
    21:09:10 [INFO] [INFO] CHUCK NORRIS APPROVA QUESTO SERVER!!
    21:09:10 [INFO] [-UTENTE-] Mrmetalgear: ce un mod online???????????????????????
    21:09:10 [INFO] [Gmlist 1.5.3] Player W4R10CK sent a command : /gm
    21:09:10 [INFO] [PLAYER_COMMAND] W4R10CK: /gm
    21:09:11 [INFO] **ICreaper [-UTENTE-] D H M 000fiver: non le rifiutiamo a nessuno
    21:09:11 [WARNING] Can't keep up! Did the system time change, or is the server overloaded?
    21:09:13 [INFO] [AuthMe] Alien4§f logged in!
    21:09:13 [INFO] *ICreaper [-VIP-] H M D ~casa88: Boss è lui che attacca
    21:09:13 [INFO] Ultima [-UTENTE-] H M Jack: cibo
    21:09:14 [INFO] [AuthMe] baluba007§f logged in!
    21:09:14 [INFO] [AuthMe] RevengeXXX96§f logged in!
    21:09:15 [INFO] **PirateLOL [-UTENTE-] M H W mrponji: a quanto?
    21:09:15 [WARNING] Can't keep up! Did the system time change, or is the server overloaded?
    21:09:16 [INFO] [Gmlist 1.5.3] Player diquinonpassi sent a command : /gm
    21:09:16 [INFO] [PLAYER_COMMAND] diquinonpassi: /gm

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

    Paswaru

    This won’t fix your error, but as an observation:

    21:09:06 [INFO] Creating empty config: /root/codecraft/servers/b2149/plugins/Essentials/userdata/baluba007.yml

    It is best practice not to run a service with any more privileges than necessary. Create a non-privileged user account and run it under that. The reason beginning, if you happen to install a rogue plugin or someone discovers a remote code exploit; it could help limit what else they can gain access too.
     
  16. Offline

    levisn1

    Ahh ok thanks :)
     
  17. Offline

    beleg

    yes ;)
     
  18. Offline

    levisn1

    putty say this error : E486: Pattern not found: 4 * * *
    so? :(

    in minecraft file i found this rdbackup is the same? help me pls..
     
  19. Offline

    beleg

    levisn1
    you have to write the line ("0 */4 * * * /etc/init.d/minecraft backup ramdisk") into the crontab. Just do what I said.
     
  20. Offline

    Toasty

    As noted in a previous post, the command for backing up the ramdisk has been changed from "rdbackup" to "backup ramdisk" as of version 0.4.3. It is highly suggested that you use 0.4.3 as it is the latest version and this script is still in development.

    Though "ramdisk backup" will basically take a snapshot of the whole ramdisk, whereas "world backup" will simply backup the worlds. World backup works the same whether you're running the server in a ramdisk or not, so it is suggested that you run that command instead.
     
  21. Why on earth do i want to store everything on my ramdisk? I want to run my worlds there yes but not the entire server then i will need to do rsync backups very frequently otherwise i loose everything if the server crashes.

    Please explain :S

    Never mind I misunderstood the text. Though I would like to know how the worlds get saved? I can't find the option to save the worlds and then save the files to the disk so it wont disappear when restarting the server.
     
  22. Offline

    Toasty

    If you restart the server by calling the script, it will automatically save the world files to the disk before stopping. Some people have had a few issues with the script not properly saving the files to the disk though (assuming they were loaded into a ramdisk).

    If you just call the script with the command "backup worlds" it will backup any current world data to the archive/backup folder designated in the script's settings. If the script doesn't properly save the world data to the hard drive, you can extract the most recent world files from the archive folder, and replace the world files in your worlds folder with the ones you extracted from the archive.

    I haven't been able to work on the script for a couple of weeks now, but I've pulled in some changes from Paswaru's fork and I'll push them to my Github repo as soon as I get a chance. He's fixed a number of things with the script and made a few good improvements as well.
     
  23. Ah yes I figured that thanks for the reply.

    I'm also wondering if there is a way to log everything that happens with the script, because I have experienced some random downtime of the server, and I have no where to look for errors. I'm also wondering if the script cleans the server.log as well because that I don't want :p
     
  24. Offline

    Toasty

    We haven't yet implemented any logging functionality, but no, it doesn't touch the server.log file in any way. At any rate, the script itself shouldn't cause any issues with stability. All I can tell you is to make sure that the ramdisk has enough space for all of your worlds with a bit left over, and to make sure you're not giving the JVM too much RAM in your invocation.
     
  25. Offline

    beleg

    Toasty my ramdisk is over 2 gb big and my server keeps timing out when backing up. (Every 6 hours service minecraft backup ramdisk..) any ideas how I could fix that?
     
  26. Offline

    Toasty

    Are you backing up the whole ramdisk, or just the worlds? ( "backup ramdisk" or "backup worlds")

    What error do you get when the backup times out?


    As far as the backup process is concerned, there's nothing in the script specifically that expects a backup to take a certain amount of time. The only time the script is expected to wait for a specific period of time is when the ramdisk is being unloaded prior to stopping the service.
     
  27. Okay.

    I was also thinking about the backup service, I do have the same problem as beleg has my server times out and i backup my server every 2 hours. Also i get the problem where the backups need to be deleted and i manually have to do this which can get pretty irritating after a while :/
     
  28. Offline

    beleg

    no errors. the minecraft server itself just has an lagg for 30 seconds then everyone recieves the time out message and when the .tar process is done the server is back up again (without restarting)
     
  29. Offline

    Toasty

    beleg that seems like a performance issue. I talked to some other people who have made similar scripts a number of months ago about how they handle backups, and the ones who had large world files ( >1GB) all opted for using rsync instead.

    My server's maps have never gotten horribly large, so I never worried about the potential performance issues of doing a full backup. Regardless, we saw this being a problem quite some time ago and started work on implementing rsync for incremental backups.

    Basically, your server is timing out because a full backup of 2GB of data with a checksum is too taxing for your server. Unfortunately I don't have a time frame for the complete inclusion of rsync, but it's the at the top of our feature list.

    Fronix That's one reason why we haven't built automatic backups into the script yet. We don't have a function to parse backups and clean them systematically, so the backups folder would just get full of old backups. It's something we've planned on adding to the script for quite some time now though.
     
  30. Offline

    beleg

    Toasty please do that when you find the time. It's really annoying for my players :/ But I don't see why my minecraft server is down when running the cheksum I have 12 x 3.4 ghz cores I thought that would fix such problems xD
     
Thread Status:
Not open for further replies.

Share This Page