mirror of
https://github.com/Gozargah/Marzban.git
synced 2026-05-17 00:25:53 +03:00
marzban systemctl service installer
This commit is contained in:
27
install_service.sh
Executable file
27
install_service.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
SERVICE_NAME="marzban"
|
||||
SERVICE_DESCRIPTION="Marzban Service"
|
||||
SERVICE_DOCUMENTATION="https://github.com/gozargah/marzban"
|
||||
MAIN_PY_PATH="$PWD/main.py"
|
||||
SERVICE_FILE="/etc/systemd/system/$SERVICE_NAME.service"
|
||||
|
||||
# Create the service file
|
||||
cat > $SERVICE_FILE <<EOF
|
||||
[Unit]
|
||||
Description=$SERVICE_DESCRIPTION
|
||||
Documentation=$SERVICE_DOCUMENTATION
|
||||
After=network.target nss-lookup.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/env python3 $MAIN_PY_PATH
|
||||
Restart=on-failure
|
||||
WorkingDirectory=$PWD
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
systemctl daemon-reload
|
||||
|
||||
echo "Service file created at: $SERVICE_FILE"
|
||||
@@ -1,12 +0,0 @@
|
||||
[Unit]
|
||||
Description=Marzban Service
|
||||
Documentation=https://github.com/gozargah/marzban
|
||||
After=network.target nss-lookup.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/env python3 /var/lib/marzban/main.py
|
||||
Restart=on-failure
|
||||
WorkingDirectory=/var/lib/marzban
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user