So many screens!

Discussion in 'Performance Tweaking' started by _Burnt, Jul 6, 2015.

  1. Alright, so this is basically what I do to start my server:

    screen -R bungee
    cd /home/bungee

    Then when I end my server, I do it all over again. Now, I've noticed that when going back and looking at my screens: screen -ls, there is a ton of attached/detached screens!

    So what I am wondering is this: is there another way to start my server's? Perhaps a script to start them all at once? Maybe a restart script?

    Here's my start script:

    Code (Text):
    java -Xmx2G -Xms128M -jar BungeeCord.jar
    Is there a better one to be using?

  2. Bump It's still doing it!
  3. foncused

    Moderator Patron

    I use a startup script that creates all my screens and starts Bungee, my database instance, and some other stuff.
    Code (Text):
    # To start the sessions you want
    screen -S name
    Code (Text):
    # To reattach to detached screens
    screen -r name
    Avoid using -R because -R only reattaches if possible. Otherwise it creates a new screen, which is likely your problem.
    Code (Text):
    # To kill screens
    screen -X -S name quit
    # If you have multiple screens with same name, use its pid (number) instead
    screen -X -S pid quit
    # To kill all screens
    killall -15 screen
    You can always use "screen -help" to see the usage too.
    If you want a simple way to automatically restart your server, this is one way:
    Code (Text):

    # Restarter
    while true
        java -Xmx2G -Xms128M -jar BungeeCord.jar
        echo "Rebooting in:"
        for i in 5 4 3 2 1
          echo "$i..." && sleep 1
        echo "Rebooting now!" && clear
    You'll just need to hit Control+C during the countdown if you want to stop the restart.
  4. I like that. I'll just use the basic ones. :)

    I can boot from my phone anyways. If only there was a way to have it email me or send me a text when the server went down. ;P