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 Administrator

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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: server.properties)

    -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

    Example:
    Code:
    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.  
  3. Offline

    weirdbeard

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Just some clarification... Does Bukkit pickup any non-specified parameters from the .properties file specified by -c?

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

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

    Thanks!
    Adam
  4. Offline

    PipeHead

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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?
  5. Offline

    4am

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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:
    /usr/bin/java -d64 -server -Xms512M -Xmx1024M -jar craftbukkit.jar -c /vm125/users/PipeHead/server.properties -nogui
    /usr/bin/java -d64 -server -Xms512M -Xmx1024M -jar craftbukkit.jar -c /vm764/etc/bukkit/server.properties -nogui
    and so on and so forth...
  6. Offline

    Adambean

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    ^ 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.
  7. Offline

    Schmeckendeugler

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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
  8. Offline

    weirdbeard

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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. :)

    Thanks!
    -WB

    *Edit: Punctuation and typos.
  9. Offline

    Dinnerbone Bukkit Team Member Administrator

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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.
  10. Offline

    Adambean

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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.
  11. Offline

    Dinnerbone Bukkit Team Member Administrator

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    The op system will go once permissions are done, and banned players will be taken over by a default plugin.
  12. Offline

    rushone2009

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Everything works fine for me :)
    --- merged: Jan 16, 2011 1:30 AM ---
    Can anyone explain "permissions"? Is that like server mod permissions from mojang?
  13. Offline

    Dinnerbone Bukkit Team Member Administrator

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Permission system = which players can do what
  14. Offline

    cbresee

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Is ScrapBukkit safe to use?
  15. Offline

    weirdbeard

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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.
  16. Offline

    Graziano von Allmen

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Is there a chance to get an option like this?

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

    barghest

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    You run it in Linux? I just prefix my start.sh 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.
  18. Offline

    weirdbeard

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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.

    -WB
  19. Offline

    marshall

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    so will hmod pulgs work 4 this like world edit or world gard????
  20. Offline

    KonoR

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I think this is a good addition.

    Ignore the haters, Bukkit Team!!
  21. Offline

    Graziano von Allmen

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Sounds great, I'll try that, thanks man!
  22. Offline

    barghest

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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. :|
  23. Offline

    Tazzernator

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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.
  24. Offline

    weirdbeard

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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. :)

    -WB
  25. Offline

    barghest

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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 ;)
  26. Offline

    MonsieurApple

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Just a few clarifying questions...

    Bukkit has not added any options other then the ones found in server.properties?

    The command line options override the server.properties file?

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

    --Edit--

    Also, all the command line options are broken :( See here -> http://redmine.bukkit.org/issues/235
  27. Offline

    Etsijä

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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 server.properties 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.)
  28. Offline

    Drizien

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I'm a noob when it comes to linux and scriptiong, though I am running a linux server like this:
    Code:
    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:
    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:
    ./ts3server_startscript.sh start
    ./ts3server_startscript.sh 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...
  29. Offline

    NikolaiH

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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:
    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 ;)
  30. Offline

    Drizien

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
  31. Offline

    NikolaiH

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    LOL, high level of epicnesss :D
  32. Offline

    8e8

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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