Startup script for GNU screen

Here’s how you start up a GNU screen session at startup and give it a command to run.

So in this case we’re starting a minecraft server in a screen session.

Per the man page -dm does the following:

the -S gives the screen session a name so it’s easier to find later on.

Then it runs the command, java, with its parameters.

———————————————————————————

Another useful tool is sudo, so we can run our above startup script as a different user than root.

startMinecraft is the first bash script above. Here we’re using sudo to run it as the user ‘minesrv’.

The -i makes sudo perform all the standard login processes before running the script.

—————————————————————-

And finally, you can just reference the startup script inside /etc/rc.local for most linux distros. That will make the script run at startup.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *