websoft9/deploy/websoft9.service
2023-09-18 17:13:15 +08:00

22 lines
541 B
Desktop File

[Unit]
Description=My fastapi app
Requires=network.target
After=network.target
[Service]
KillSignal=SIGQUIT
WorkingDirectory=/data/develop/stackhub/api
ExecStart=python3 uvicorn main:app --reload
Restart=always
Type=notify
NotifyAccess=all
StandardError=syslog
[Install]
WantedBy=multi-user.target
internal_ip=$(ip addr show eth0 | awk '/inet /{split($2, a, "/"); print a[1]}')
nsenter -m -u -i -n -p -t 1 sh -c "sed -i '/websoft9-apphub/d' /etc/hosts"
nsenter -m -u -i -n -p -t 1 sh -c "echo $internal_ip websoft9-apphub>> /etc/hosts"