#!/bin/bash
./Prepare.sh
cd ..

ServiceName=$(python3 Scripts.py --getconfig PROGNAME)
SHMName=$(python3 Scripts.py --getconfig SHMNAME)

echo '[Unit]
Description=Запуск '$ServiceName'

[Service]
WorkingDirectory='$PWD'/shell
ExecStart='$PWD'/shell/Gunicorn.sh
User='$USER' 
Group='$USER'

[Install]
WantedBy=multi-user.target


' > /tmp/site_$SHMName.service

#echo "Устанавливаем сервис для пользователя $FNAME"
sudo cp /tmp/site_$SHMName.service /etc/systemd/system/site_$SHMName.service
sudo systemctl enable site_$SHMName.service
sudo systemctl restart site_$SHMName.service
