Добавил сервис для linux

This commit is contained in:
2025-01-14 15:35:12 +03:00
parent f9ce231443
commit f7ea898049
2 changed files with 29 additions and 1 deletions

View File

@@ -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 <<EOF > /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

View File

@@ -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