GSPs and CLI-freaks!

Discussion in 'Bukkit News' started by Dinnerbone, Jan 4, 2011.

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

    Dinnerbone Bukkit Team Member

    Good news! Craftbukkit (the runnable version of Bukkit, a wraper around minecraft_server.jar) now takes command line arguments!

    -?, --help
    Show the help​

    -P, --plugins <File: Plugin directory>
    Plugin directory to use (default: plugins)​

    -c, --config <File: Properties file>
    Properties file to use (default:​

    -h, --host, --server-ip <Hostname or IP>
    Host to listen on​

    -o, --online-mode <Boolean: Authentication>
    Whether to use online authentication​

    -p, --port, --server-port <Integer: Port>
    Port to listen on​

    -s, --max-players, --size <Integer: Server size>
    Maximum amount of players​

    -w, --world <World dir>
    World directory​

    Code (Text):
    1. java -jar Craftbukkit.jar -p 1234 -s 50 -c customer/alpha/config.cfg -w customer/alpha/world -P customer/alpha/plugins

    Any thoughts or feedback? :)
  2. Offline


    Just some clarification... Does Bukkit pickup any non-specified parameters from the .properties file specified by -c?

    For example if I use:
    Code (Text):
    1. java -d64 -server -Xms512M -Xmx1024M -jar craftbukkit.jar -c -nogui
    Will craftbukkit.jar pull the IP and port from

    Oh, and does -c point to the native for minecraft or an additional properties file exclusively for configuring craftbukkit.

  3. Offline


    I was going to ask this same question. It also seems the cmd line arguments are unnecessary if bukkit is going to use a properties file or am I missing something?
  4. Offline


    You're missing something. Server admins with more than one server (i.e. hosting companies) can keep one copy of the server and each VM instance can fire it up from a central location with their own .pid, their own config files, etc by specifying the path.

    Code (Text):
    1. /usr/bin/java -d64 -server -Xms512M -Xmx1024M -jar craftbukkit.jar -c /vm125/users/PipeHead/ -nogui
    2. /usr/bin/java -d64 -server -Xms512M -Xmx1024M -jar craftbukkit.jar -c /vm764/etc/bukkit/ -nogui
    and so on and so forth...
  5. Offline


    ^ I think he is saying that some of the options (host IP, port, and world) are not needed at all if you are specifying a different configuration file as they would all be read and ultimately take effect from the configuration file rather than the command line.
  6. I have a thought/feedback. For me what's important is, I wanna be able to schedule jobs for my server. Job would obviously go something like this...
    1- send console announcement
    2- pass command to server to stop saving chunks
    3- copy backup files
    3.1- backup mysql db
    3.2 backup all flat files :& other indicated dirs
    4- pass command to server to start saving chunks
    5- generate map & rsync to ftp/folder
    6- make changes to some variables in the database if necessary

    ..stuff like that
  7. Offline


    What he said. ;) I could see an admin wanting to specify a config file location at least but if the config file has everything else, then is anything else really needed at the command line? (An admin could easily specify a unique config file and nothing else to get all unique server parameters, no?) But, having to specify it on the command line and then AGAIN in the config file seems like more work for an admin, tbh. :)


    *Edit: Punctuation and typos.
  8. Offline

    Dinnerbone Bukkit Team Member

    The command is just an override from whatever is in the properties file. I know the options are redundant if you specify them in the properties file, but it's there just in case.
  9. Offline


    Will it also be possible to set a location for other files (banned players, ops, etc)?

    It would be far easier if it were possible to specify a base configuration path in the command line, which would become the default location for Bukkit to look for any configuration file.
  10. Offline

    Dinnerbone Bukkit Team Member

    The op system will go once permissions are done, and banned players will be taken over by a default plugin.
  11. Offline


    Everything works fine for me :)
    --- merged: Jan 16, 2011 1:30 AM ---
    Can anyone explain "permissions"? Is that like server mod permissions from mojang?
  12. Offline

    Dinnerbone Bukkit Team Member

    Permission system = which players can do what
  13. Offline


    Is ScrapBukkit safe to use?
  14. Offline


    Oh, it's very useful! Thanks for clarifying... Just wanted to make sure I had everything I needed on the cmd line and in the properties file and to make sure the properties file was the only properties file the server itself will be looking at. (I realize plugins might have their own properties files.)

    *Edit: Typo.
  15. Is there a chance to get an option like this?

    -d, --daemonize
    Runs Craftbukkit in the background
  16. Offline


    You run it in Linux? I just prefix my with "screen" - so get a working script to start it up, and then put screen as the very first word of it - and then, as soon as I start it up, immediately detach from the window with Ctrl-A-D. Then I can log out and the server keeps running - when I need to come back to it, I type screen -r and it pops up again. Works great actually.

    Kinda the best of both worlds, I tried nohup and stuff, and it kinda tries to log the server's output two times, once with the server.log and once with the console output... eh. This is way more elegant.
  17. Offline


    Save yourself a step... Prefix with "screen -dmS minecraft" instead. This will start it in a screen session already detached and with a friendly session name. :)

    I agree: Using screen allows for more flexible control of your sessions that if the plugin itself ran as a daemon... Not sure about Windows servers, though. They could probably use something like that.

  18. Offline


    so will hmod pulgs work 4 this like world edit or world gard????
  19. Offline


    I think this is a good addition.

    Ignore the haters, Bukkit Team!!
  20. Sounds great, I'll try that, thanks man!
  21. Offline


    NP. Don't forget to listen to ol' weirdbeard above, though; "screen -dmS minecraft"

    Heh, weirdbeard: through my readings about screen, I'd already put -dm (done as -d -m, since I'm a moron .BAT scripter at heart; fixed after I read your post), but not -S. So -S minecraft will title the screen session "minecraft" eh?

    See, I'm also using screen -X stuff, plus cronjobs, to implement a (hackjob) backup system by #save-off, archive, #save-on. Blah blah. It was a hassle to figure out. My question to you is:

    Gosh, screen sure seems convenient. I'm not really new to operating a Linux system, but I've never bothered to learn about screen before and I'll probably use it more. If I blindly go "screen -X commands" in my bash scripts, if I've got more than one screen session running I certainly run the risk of mashing #save-all commands into other programs, don't I? If I set -dmS minecraft, do I go like "screen -XS minecraft commands" ?

    IIRC, it's something vaguely similar, but asking you is way easier than reading the colossal man file another six times until I get it.

    EDIT: If I understand correctly, it's actually a known issue that a screen session can't/won't accept any "stuff" commands unless it has been attached/detached at least once. Groovy. :|
  22. screen -r minecraft -X stuff "`printf "say TAZZ BACKUP: Starting\r"`"
    screen -r minecraft -X stuff "`printf "say TAZZ BACKUP: Forcing Save..\r"`"
    screen -r minecraft -X stuff `printf "save-all\r"`
    screen -r minecraft -X stuff "`printf "say TAZZ BACKUP: Packing and compressing world...\r"`"
    tar -czf /home/tazzernator/Servers/Minecraft/bin/world
    screen -r minecraft -X stuff "`printf "say TAZZ BACKUP: Backup Completed.\r"`"

    ^^ That is my cron job hourly, in VERY basic terms. The same can be applied for anything.
  23. Offline


    Yes, screen is wonderful, isn't it? :) I have only recently started playing with it myself and it has totally simplified everything I do.

    Tazz just posted some excellent examples of what it looks like you want to do. Thanks Tazz! I tried sending commands to the console in this manner myself a while back and it would not work. I could not get the console to recognize the LF/CR at the end of the statement so the commands just kept stacking end-to-end. That was wayyyy back in alpha, though. ;) Maybe things have changed now. Then again, I was new to it then and might have made some mistakes. Gonna try your crontab script. :) Looks like the basic rule of thumb might be to mind those quotation marks! LOL

    I got the inkling to use "screen" from someone either on the minecraft or the hMod forums. The rest was those tedious man pages you mentioned. Oh- and Google. :)

  24. Offline


    Heh. Yeah, Tazz's sh script looks identical to mine in its function :p Except that I also do save-off so tar doesn't get confused.

    Seriously though - anyone else trying to implement this should take note. For this application specifically, it's best NOT to start craftbukkit.jar in a detached screen session, because screen -X stuff does not work with a session that has never once been attached. Start it attached, detach it immediately. It's an ugly workaround, but it's just an MC server, not nuclear missile targeting or something ;)
  25. Offline


    Just a few clarifying questions...

    Bukkit has not added any options other then the ones found in

    The command line options override the file?

    Is there any layout for what permissions are gonna be like?


    Also, all the command line options are broken :( See here ->
  26. First of all, kudos to Bukkit team for your valuable work!

    Secondly, I have the same question as MonsieurApple: are the only options supported the ones that are listed in of each installed build? Do you have even a rough roadmap for the features which are going to be in next?

    I am asking since I get my CraftBukkit server to run just fine - but when I log out and back in to my server, my location is resetted to the world's spawn point and I lose all my inventory. I am wondering whether this is due to Bukkit not supporting inventory, /home etc. yet...

    (Sorry if I'm missing something obvious, but I DID try to find any info on Bukkit's roadmap. Moreover, I am new to setting up a server, so I may be doing something wrong.)
  27. Offline


    I'm a noob when it comes to linux and scriptiong, though I am running a linux server like this:
    Code (Text):
    1. screen -S minecraft java -d64 -Xms1024M -Xmx1024M -jar craftbukkit-0.0.1-SNAPSHOT.jar nogui
    so I can get to that screen when I relog:
    Code (Text):
    1. screen -r minecraft java -d64 -Xms1024M -Xmx1024M -jar craftbukkit-0.0.1-SNAPSHOT.jar nogui
    I also am running a TS3 serevr there, which came with a scrip where I can do like this to start or stop:
    Code (Text):
    1. ./ start
    2. ./ stop
    Can this be done for craftbukkit? could anyone post an example of this if it can be done? I would really appreciate it if it were it were possible to do like ./bukkitserver start or something...
  28. Offline


    It should be exactly the same just swap eventual jars and make sure the paths and names are proper. You dont need to do
    Code (Text):
    1. screen -r minecraft java -d64 -Xms1024M -Xmx1024M -jar craftbukkit-0.0.1-SNAPSHOT.jar nogui
    to resume the screen. A simple "screen -r minecraft" is more than enough ;)
  29. Offline


  30. Offline


    LOL, high level of epicnesss :D
  31. Offline


    Any chance on being able to set the log directory? I'd much appreciate that.
Thread Status:
Not open for further replies.

Share This Page