Kian Cross
Kian Cross

Reputation: 1818

How can I start a screen session using a specific config file?

I would like to be able to start a screen session using a certain config file. I know that I can use -c and then the file path to the config file but if I do that, then the sh script I am using does not work. You can see the sh script below:

#!/bin/bash
cd /media/kiancross/Minecraft_Server/1.6.4
screen -d -m -S MinecraftServer ./start.sh
screen -r MinecraftServer

I would have thought that I can do the following code:

#!/bin/bash
cd /media/kiancross/Minecraft_Server/1.6.4
screen -d -m -S -c MinecraftServer $HOME/config_file/mcserver.config ./start.sh
screen -r MinecraftServer

But then I get a message saying:

There is no screen to be resumed matching MinecraftServer.

After then checking to see if there is a screen session running it says that there are no screen sessions running

No Sockets found in /var/run/screen/S-kiancross.

Does anybody know how I can do this so that I can use a custom config file?

Upvotes: 0

Views: 1002

Answers (1)

Barmar
Barmar

Reputation: 781096

The command should be:

screen -d -m -S MinecraftServer -c $HOME/config_file/mcserver.config ./start.sh

The name of the screen session goes after -S and the path of the config file goes after -c. You inserted -c before the screen name.

Upvotes: 2

Related Questions