791 B
791 B
- Open new service file:
sudo nano /etc/systemd/system/<name>.service
- Content
[Unit]
Description=Page Host Service
After=network.target
[Service]
User=your_username
WorkingDirectory=/home/your_username/repo/asobi
Environment=PYENV_ROOT=/home/your_username/.pyenv
ExecStart=/bin/bash -c "source $PYENV_ROOT/bin/pyenv && pyenv activate pyenv && python page_host.py"
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
- Reload systemd, enable service:
sudo systemctl daemon-reload
sudo systemctl enable <name>.service
sudo systemctl start <name>.service
- Check status:
sudo systemctl status <name>.service
journalctl -u <name>.service
- Test reboot:
sudo reboot
Check status
sudo systemctl status page_host.service