SystemdでPythonアプリを永続化する – Ubuntu 18.04.3 LTS
準備
$ cd /etc/systemd/system
$ sudo vim app.service
Systemd実装
[Unit]
Description=App
[Service]
ExecStart=/bin/bash -c '/home/ubuntu/.pyenv/shims/python /opt/theme/app.py'
WorkingDirectory=/opt/theme
Restart=always
Type=simple
User=ubuntu
[Install]
WantedBy=multi-user.target
実行
$ sudo systemctl daemon-reload
$ sudo systemctl start app.service
$ sudo systemctl status app.service