My apologiess if this is the wrong board but I wasnt sure where shell stuff should go but my server is a Linux one so...

-------

screen -S minecraft
screen -X
cd ./public_html/mcmyadmin/
mono McMyAdmin.exe -nostart

I'm using the above code to auto atart a game server on my VPS's reboot. Well, the screen starts but then nothing else happens, if I close the screen out I see that -X run but says there's nothing to attach to and then the rest of the stuff runs. It seems the other commands aren't being sent to the screen after the intial screen start command is sent. Can anyone help me figure out why ?

If was also suggested I not use a CD but instead use a full path for the file, not sure what the person meant who told me that. Unless the mean do away with the CD line and maybe do something like mono /fullpath/McMyAdmin.exe -nostart.

Dani AI

Generated

The symptom you describe usually comes from starting an interactive screen session from a script and then expecting the script to keep sending commands into that attached session. An attached screen will block the script until it is detached or closed, so the following lines run in the original shell (or only run after the screen session ends). The reliable fixes are: run your server command inside a detached session, or have screen run a small wrapper script that sets the working directory and starts the server.

Create a tiny wrapper that sets cwd and launches the server with absolute paths so the boot/cron environment does not rely on PATH or a relative directory. Example wrapper (save as /home/you/start_mc.sh and make executable):

#!/bin/sh
cd /home/you/public_html/mcmyadmin || exit 1
exec /usr/bin/mono /home/you/public_html/mcmyadmin/ServerLauncher.exe --no-start

Using a wrapper avoids fragile sequences of separate cd and run lines being executed in different environments. Start that wrapper inside a detached session (or use a daemonizing method such as nohup or setsid) so the boot script continues immediately rather than blocking.

As recommended, prefer detached-start for automation. Also follow these checks: always use full paths to mono and the .exe when launching at boot; verify sessions and names with the screen listing command; capture stdout/stderr to a log to see startup errors; consider a systemd unit for a production server if the VPS supports systemd. See the screen manual for the exact detached/start syntax and remote-control options: screen manual.

Recommended Answers

All 2 Replies

Perhaps try starting screen in detached mode. Something like:

$ screen -d -m minecraft
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.