shell script to run a screen session

Discussion in 'Bukkit Help' started by 5tinger, Dec 6, 2011.

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

    5tinger

    I would like to create a shell script to launch a screen session named "CraftBukkit" and then Start.sh (my shell script to launch my server) will be launched inside the CraftBukkit screen session Is this possible?
     
  2. Offline

    Greylocke

    Try this as a starting point:
    screen -S CraftBukkit -dmS Start.sh
     
  3. Offline

    5tinger

    ok I'll give it a try. what is the -dmS switch?
     
  4. Offline

    Greylocke

    -d detach from an existing screen session, and reattach here
    -m force a new screen session
    -S create a named session instead of using the default name
     
  5. Offline

    5tinger

    I tried that and it goes to next line but does not create a screen session and does not run the shell script
     
  6. Offline

    Greylocke

    try typing the commands into the console, exactly how the script would run them. It is easier to see any errors that get thrown.

    If all you're doing is starting your craftbukkit from this script, you can do it all from this. You don't need to call a second script. For example, this is what I use to launch craftbukkit:
    Code:
    #!/bin/bash
    cd "${0%/*}";  screen -S bukkit -dmS java -Xnoclassgc -Xms1024M -Xmx1024M -jar craftbukkit.jar nogui
    
     
  7. Offline

    5tinger

    that seems to work when I take out "cd "${0%/*}"; "

    could you break down what that does?
     
  8. Well the 'cd' bit means whatever path to a directory follows it, is where the 'working directory' is set, so any commands done after that will be performed in that directory. The screen bit is then the screen command from the first reply, and where it says 'bukkit' is what the screen session is going to be called. -dmS is what was said in an above post, then java -Xnoclassgc and onwards is the starting script for the server. -Xms1024M -Xmx1024M is how much RAM you want to run your server with. -jar craftbukkit.jar is your craftbukkit server's main jarfile name and nogui simply means that it won't load up the GUI.
    Sorry for bumping on old thread but I just wanted to help out as I use this script on my server :)
     
Thread Status:
Not open for further replies.

Share This Page