Restart command running out of memory.

Discussion in 'Performance Tweaking' started by Cervinakuy, Jun 12, 2016.

  1. Hey guys,

    I am running a start script using screen and it works great from the command line. However, when the script is called using the restart command, it complains as running out of memory. Interesting enough, if I run the command directly from the console everything is fine. I want to do this process automatically, instead of manually starting each time. I am also running a lean server by design.

    start.sh
    Code (Text):
    #!/bin/sh
    screen -dmS skysession java -Xms1G -Xmx1G -XX:+UseConcMarkSweepGC -jar spigot-1.8.8.jar
    Any help would be appreciated,
    -Cervinakuy
     
  2. Use this two part script setup and your issues should be resolved it us

    Script #1 - start.sh

    Code (Text):
    #!/bin/sh
    screen -m -S skysession /screen.sh
    Script #2 - screen.sh

    Code (Text):
    #!/bin/sh
    cd /to/the/dir/your/server/jar/is/in
    while true
    do
            java -Xms1G -Xmx1G -XX:+UseConcMarkSweepGC -jar spigot-1.8.8.jar
            echo "If you want to completely stop the server process now, press Ctrl+C before the time is up!"
            echo "Rebooting in:"
            for i in 5 4 3 2 1
            do
                    echo "$i..."
                    sleep 1
            done
            echo "Rebooting now!"
    done
     
    What's great about this script setup is if the server Crashes it will start right back up
     
  3. This is awesome! I'll test it to see if it works.

    Thanks again,
    - Cervinakuy
     
  4. I tested it and it works great! Thank you so much, +1 follow for that <3.

    Also, you forgot the . in front of the script called screen.sh.

    So it would be:

    Code (Text):
    screen -m -S skysession ./screen.sh
    I just wanted to clarify so anyone in the future that saw this thread wouldn't be confused :).
     
    #5 Cervinakuy, Jun 17, 2016
    Last edited: Jun 17, 2016