Does anyone know how to start a new screen with the name mc and then run a command in it?

I've been trying
screen -S 'mc' -d -m java -jar /home/mc/minecraft/craftbukkit.jar

But it's not working.
Start screen without any options and then run the command. Then, disconnect the SSH connection. The command will continue running.
I got it.
screen -S 'mc' -p 0 -X command


[root@test ~]# screen -S 'mc' -p 0 -X echo test
No screen session found.

This doesn't work unless a screen session has been started. You can put that in .screenrc or setup a bash script to invoke a screen first snd send the command using the above flags. Are you trying to create a cron job?
No, this would be a start-up script for a Minecraft server.
When they execute the script, it will start a new screen named mc and run java -jar craftbukkit.jar
Did you look at the init script I sent you?
Inside your init script, it's:
screen -dmS minecraft /minecraft/

I modified that to be:
screen -dmS minecraft 'java -jar craftbukkit.jar'

However, when I do screen -r, it says that there are no screens to be resumed.
What happens when you run "java -jar" ? It may be that the screen session is closing since java exits or has an error or something.\

Edit: Also keep in mind that if its in the init script, you need an absolute path to craftbukkit.jar specified

Edit 2: FYI, screen -ls will list the screen sessions for the current user.
What about do screen -x
martip07, personal site
FreeVPS, for give me a good vps 
I forgot to set the privvmpages to 700M for the OpenVZ container that I was testing it in, so it kept running out of memory.

EDIT: For me, it's just a bash script.

Users browsing this thread: 1 Guest(s)