https://dev.kronoz.win/r/marzneshin.git
1#!/bin/bash
2
3SERVICE_NAME="marzneshin"
4SERVICE_DESCRIPTION="Marzneshin Service"
5SERVICE_DOCUMENTATION="https://github.com/khodedawsh/marzneshin"
6MAIN_PY_PATH="$PWD/main.py"
7SERVICE_FILE="/etc/systemd/system/$SERVICE_NAME.service"
8
9# Create the service file
10cat > $SERVICE_FILE <<EOF
11[Unit]
12Description=$SERVICE_DESCRIPTION
13Documentation=$SERVICE_DOCUMENTATION
14After=network.target nss-lookup.target
15
16[Service]
17ExecStart=/usr/bin/env python3 $MAIN_PY_PATH
18Restart=on-failure
19WorkingDirectory=$PWD
20
21[Install]
22WantedBy=multi-user.target
23EOF
24
25systemctl daemon-reload
26
27echo "Service file created at: $SERVICE_FILE"