Pasta contendo os serviços:
/etc/systemd/system/
/usr/lib/systemd/system
Exemplo de serviço:
[Unit]
Description=Scheduler Listener
After=network-online.target
[Service]
WorkingDirectory=/home/project_python
ExecStart=/home/project_python/venv/bin/python schedules_listener.py start
Restart=no
RestartSec=60s
KillMode=process
TimeoutSec=infinity
User=inspiron
Group=root
[Install]
WantedBy=multi-user.target
Comandos:
systemctl enable <service file name without .service extension>
systemctl disable <service file name without .service extension>
systemctl daemon-reload
systemctl start <service file name without .service extension>
systemctl stop <service file name without .service extension>
# Verificação do log
sudo journalctl -f -u service_file_name.service
Nenhum comentário:
Postar um comentário