-3

I'm new to all of this so I probably made a big rookie mistake. I want to start a screen, which was successful, and then run command, which is not working. When I terminate the screen the command runs, but it needs to be ran on that specific screen. Thank you all in advance.

#!/bin/bash
clear

cd ~/Directory/

screen -S "Screen_Name"; java -Xmx1024M -Xms1024M -jar server.jar nogui
1

1 Answer 1

0

You have two separate commands, separated by ;. The second command, as you've observed, doesn't run until the first one exits. What you want is to pass the java command and its arguments as arguments to screen.

screen -S "Screen_Name" java -Xmx1024M -Xms1024M -jar server.jar nogui

This will run the java command in the screen session's initial window. When the java command exits, the screen session will terminate as well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.