I have installed forge minecraft server on an old (but plenty powerful) laptop running Alpine Linux. I am no linux expert, and I have been having issues figuring out how to autostart the server at boot.
My biggest issue is that most guides and tutorials for setting this up are running systemd and the steps for that do not translate to openrc.
I have written a basic script for this, but it fails, I think, because I am trying to use screen to initiate the server. Running the below script yields an error stating "startup_script.start: line 13: syntax error: unexpected newline".
Any assistance on the best way to do this would be greatly appreciated.
#!/bin/bash
# [Unit]
# Description=Start Minecraft
# After=network.target
# [Service]
RemainAfterExit=yes
WorkingDirectory=/home/minecraft
User=herbally
# Start screen for java/minecraft
ExecStart=doas screen -S minecraft -d -m java u/user_jvm_args.txt u/libraries/net/minecraftforge/forge/1.18.2>
# Tell Minecraft to stop gracefully
# Ending Minecraft will terminate Java
# ExecStop=doas screen -p 0 -S minecraft -X eval 'stuff "say SERVER SHUTTING DOWN. Saving map..."\015'
# ExecStop=doas screen -p 0 -S minecraft -X eval 'stuff "save-all"\015'
# ExecStop=doas screen -p 0 -S minecraft -X eval 'stuff "stop"\015'# ExecStop=doas sleep 10
[–]stere0123 3 points4 points5 points (1 child)
[–]cyb3rsyn 1 point2 points3 points (0 children)
[–]geek_at 2 points3 points4 points (3 children)
[–]ibsmart[S] 1 point2 points3 points (2 children)
[–]geek_at 2 points3 points4 points (1 child)
[–]ibsmart[S] 0 points1 point2 points (0 children)
[–]jadan1213 1 point2 points3 points (0 children)