Score:1

Applications Menu entry to start a local server in a Terminal and keep the terminal open for input

cn flag

I would like to achieve the following:

By clicking on an Applications Menu entry, start a Minecraft server, which for the moment is running on my Ubuntu machine, keeping the Terminal window open (as a Console). I can then manage the server from that 'Console Window' when I return to the 'screen'.

I have tried this script from a .sh file on my desktop until I get it working:

#!/bin/bash
screen
cd /media/terabyte/minecraft/
./start.sh

But the terminal closes and the server is left running but I cannot control it and must kill it from the task manager.

vanadium avatar
cn flag
Sure the server is left running? I expect that the script like you presented it drops you to a terminal prompt provided by screen. When you detach that session or end that session, the server is started and the script ends.
Score:0
cn flag

To run the minecraft server in a screen session and keep that open when the minecraft server is terminated, change your script into:

#/bin/bash
screen -m bash -c 'cd /media/terabyte/minecraft/ && ./start.sh ; bash'

This will run screen, and within the screen session run the commands to start the server. Once the server is started, bash is called to keep a terminal open. Otherwise, the screen session would end.

To immediately move this screensession to the background, include the -d (detach) option. Then, you will need to attach to that screen session first in order to see your bash prompt belonging to that session.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.