I have the following script that should do the following:

  1. Stop screen "server" if exists
  2. Start screen "server"
  3. Run a java program and detach screen.

However, when I firstly run the script, the program starts. But if I run it again, it does not restart it.

:set fileformat=unix
screen -S server -X quit; 
screen -dmS server; 
cd ~/cadesim-monomer; 
java -jar CadeServerEngine.jar;

What did I do wrong? CentOS 7


screen -RD server -X quit

The -RD options force your script to takeover the screen session even if another process is attached to it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.