{{tag>SystemD}}
= SystemD service script en boucle infinie respawn
''/etc/systemd/system/startPeriodicCheck.service''
[Unit]
Description=startPeriodicCheck
[Service]
#ExecStartPre=/bin/sleep 30
ExecStart=/bin/curl 127.1/WebCoding/services/PeriodicCheck.php
KillMode=process
Restart=always
RestartSec=10s
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start startPeriodicCheck
systemctl enable startPeriodicCheck
Dans notre exemple une crontab aurait très bien pu faire l'affaire.
Ou encore :
''/etc/systemd/system/plop.service''
[Unit]
Description=Plop
After=getty.target
[Service]
User=user1
Group=user1
# Default : Type=simple
Type=simple
ExecStart=/home/user1/bin/plop
Restart=always
[Install]
WantedBy=multi-user.target