0

I have a Nukkit (not Bukkit) Minecraft server, and I want it to start on boot. The command to run the server is java -jar nukkit/nukkit.jar. I want to run it in a detached screen command with the name Minecraft, so this is what I put in rc.local (right before exit 0): screen -d -m -S Minecraft java -jar nukkit/nukkit.jar. Then it just doesn't run. Whenever I type screen -r Minecraft it tells me that there's no screen session named that, and the server isn't being hosted at all. Anybody know what's wrong? Thanks in advance!

1 Answers1

0

screen sessions are I would presume (I'm a tmux user) per user. When you log in, whoever you logged in as doesn't own that session.

You could check this by using sudo screen -r ....

Try replace rc.local with:

#!/bin/bash

( su pi - c "screen -d -m -S Minecraft java -jar /absolute/path/nukkit/nukkit.jar" ) &> /var/log/init_nukkit.log

You might want to check the path of the su, screen, and java commands and use try adding those in if this doesn't work.

If pi is not the user you want, use that as the 1st arg to su instead. Also note the #!/bin/bash, not /bin/sh, so that &> works; see https://raspberrypi.stackexchange.com/a/40494/5538

goldilocks
  • 58,859
  • 17
  • 112
  • 227