Service e Timer
Per creare servizi e timer per il proprio docker procedere compilando i dati di questo template
Service
<nomeservizio>.service
[Unit]
Description=copy data from mysond to dwh twice a day
After=network.target
[Service]
ExecStart=docker exec test_dwh_utility /usr/local/bin/python3 /src/mysond/mysond.py
SyslogIdentifier=mysond-to-dwh
[Install]
WantedBy=multi-user.target
Timer
<nomeservizio>.timer
[Unit]
Description=copy data from mysond to dwh twice a day
[Timer]
OnCalendar=*-*-* 13:00:00
OnCalendar=*-*-* 00:00:00
Persistent=true
Unit=bi-mysond-to-dwh.service
[Install]
WantedBy=timers.target
- Description: siate verbosi, servirà per capire bene cosa fa il servizio ai colleghi che non hanno sviluppato questa parte
- ExecStart: avvia lo script all'interno del docker, ATTENZIONE ALLA POTENZIALE RACE CONDITION
- SyslogIdentifier: IMPORTANTISSIMO, cercate un nome evocativo per i log del servizio, questo sistema loggherà direttamente su systemd, se non usate Python3 va capito come farvi loggare
- OnCalendar: Seguite l'esempio per il "tutti i giorni alle ..." e CharGPT per cose più particolari
- Unit: mettete il
<nomeservizio>.service, attenzione a tenere consistente<nomeservizio>per timer e service
No Comments