agrobot_base/Python/raspi/Criar Serviço.txt

44 lines
971 B
Plaintext

Criar serviço de auto inicialização no boot:
sudo nano /etc/systemd/system/multispec.service
Preencher o arquivo com:
[Unit]
Description=Modulo Multiespectral
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=diego
WorkingDirectory=/home/diego/multispec_module
ExecStart=/usr/bin/python3 /home/diego/multispec_module/main.py
Restart=always
RestartSec=3
Environment=PYTHONUNBUFFERED=1
[Install]
WantedBy=multi-user.target
Recarregar o systemctl:
sudo systemctl daemon-reload
Ver status:
sudo systemctl status multispec.service
Acompanhar logs em tempo real:
journalctl -u multispec.service -f
Habilitar o serviço no boot:
sudo systemctl enable multispec.service
Desabilitar o serviço no boot:
sudo systemctl disable multispec.service
Iniciar o serviço manualmente:
sudo systemctl start multispec.service
Parar o serviço:
sudo systemctl stop multispec.service
Reiniciar o serviço:
sudo systemctl restart multispec.service