From f7ea89804990bbe5ff96e5d28d4398bcf9d5b429 Mon Sep 17 00:00:00 2001 From: "Leonov Artur (Depish)" Date: Tue, 14 Jan 2025 15:35:12 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=81=D0=B5=D1=80=D0=B2=D0=B8=D1=81=20=D0=B4=D0=BB=D1=8F=20lin?= =?UTF-8?q?ux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/linux/install_systemd_service.sh | 28 +++++++++++++++++++++++++ server/start-server.sh | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100755 server/linux/install_systemd_service.sh 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