Run the jar at startup and keep a terminal ready to capture its output
Run the jar at startup and keep a terminal ready to capture its output
I've been looking for solutions everywhere and discovered some, though not the key part. Backstory: My goal is to set up a Minecraft server using the Pi 4 B. I’m comfortable with Windows but completely new to Raspbian. I’m currently running Raspbian Desktop. To start the server at boot, I’ve tried: sudo nano /etc/rc.local java -Xms1024M -Xmx4096M -DIReallyKnowWhatIAmDoingThisUpdate=true -jar /home/pi/mc_server/spigot-1.14.4.jar -o true. This is crucial—I need to open a terminal window right away. For restarting the Pi at 4 AM, I use crontab -e 0 4 * * * /sbin/shutdown -r now, assuming this works so the server will start after reboot and auto-login will activate. For a .desktop file (so I can double-click it if needed), I navigated to /home/pi/Desktop/mc_server.desktop and ran: nano /home/pi/Desktop/mc_server.desktop # I’m unsure if this creates the executable, but others say yes. [Desktop Entry] Name=mc_server # Not required # Comment=Run the server # Not mandatory # Icon=check /usr/share/pixmaps/ Exec=java -Xms1024M -Xmx4096M -DIReallyKnowWhatIAmDoingThisUpdate=true -jar /home/pi/mc_server/spigot-1.14.4.jar -o true & Type=Application Encoding=UTF-8 Terminal=true Categories=None; I’m not sure if I own the Pi 4 B physically, but it’s on order and should arrive in a week. I need to be ready to minimize setup time. Thank you for reviewing my code and pointing out any mistakes. You’re very appreciated.
Launch Minecraft and it will record every output on the console.
I’m still adjusting to how RPi’s are now quad-core processors and they handle it well. The original model feels surprising given its capabilities. What you should focus on is systemd. This service manages bootstrapping all system processes, making it useful for setting up services from your setup and ensuring they start automatically at boot. Services are defined in files similar to desktop entries. Raspbian is essentially a Linux distro with extra tools tailored for RPi use—if you’re comfortable with Linux, you’ll get by. Another idea would be to turn off the GUI entirely and run everything from the terminal only. This can free up RAM, which is beneficial for your MC server running Java.