diff --git a/server/linux/install_systemd_service.sh b/server/linux/install_systemd_service.sh new file mode 100755 index 0000000..b954f25 --- /dev/null +++ b/server/linux/install_systemd_service.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Usage: install_systemd_service.sh ${USER} ${USER} + +if [ $# -ne 2 ]; then + echo "Usage: $0 username groupname" + exit 1 +fi + +cat < /etc/systemd/system/minecraftmodsync.service +[Unit] +Description=Minecraft Mods Sync Server +After=network.target +After=multi-user.target + +[Service] +Type=simple +User=${username} +Group=${groupname} +Restart=always +RestartSec=5s +WorkingDirectory=/opt/minecraft_simple_mod_sync/server +Environment=PYTHONPATH=/opt/minecraft_simple_mod_sync/server/.venv/bin +ExecStart=/opt/minecraft_simple_mod_sync/server/start-server.sh + +[Install] +WantedBy=multi-user.target +EOF diff --git a/server/start-server.sh b/server/start-server.sh index c97db38..6429142 100755 --- a/server/start-server.sh +++ b/server/start-server.sh @@ -1,4 +1,4 @@ #!/bin/bash source .venv/bin/activate -uvicorn main:app --host 0.0.0.0 --port 7779 +.venv/bin/python3 -m uvicorn server:app --host 0.0.0.0 --port 7779