0

I need to be able to start up a screen without connecting to it, but it also needs to run my start.sh script which contains the java line to start Minecraft.

screen -d -m new3 -c start.sh

Is what I've been trying to use, but it never runs start.sh

In a snippet of code I found on line it seems to do what I want but I need some help

 mc_start() {
    cd $MCPATH
    as_user "cd $MCPATH && screen -dmS $SCREEN $INVOCATION"
    #
    # Waiting for the server to start
    #
    seconds=0
    until ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
    do
        sleep 1 
        seconds=$seconds+1
        if [[ $seconds -eq 5 ]]
        then
            echo "Still not running, waiting a while longer..."
        fi
        if [[ $seconds -ge 120 ]]
        then
            echo "Failed to start, aborting."
            exit 1
        fi
    done    
    echo "$SERVICE is running."
}
4

1 に答える 1

1

これは、コマンドが間違っているためだと思います。new3という名前の新しいセッションを作成し、そこから切り離したいと考えています

screen -d -m -S new3 ~/start.sh

その後、次のコマンドを実行して、セッションに接続し直すことができます。

screen -R new3
于 2012-04-20T03:38:09.503 に答える