how create service linux repeat each 10s






Terminal:
nano /etc/systemd/system/test.service


[Unit]                                                                                                                                            
Description=test_job                                                                                                                              
                                                                                                                                                  
[Service]                                                                                                                                         
Type=oneshot                                                                                                                                      
ExecStart=/usr/bin/php /tmp/run.php 




Terminal:
nano /etc/systemd/system/test.timer

[Unit]                                                                                                                                            
Description=test                                                                                                                                  
                                                                                                                                                  
[Timer]                                                                                                                                           
OnUnitActiveSec=10s                                                                                                                               
OnBootSec=10s                                                                                                                                     
                                                                                                                                                  
[Install]                                                                                                                                         
WantedBy=timers.target


Terminal:
systemctl daemon-reload

Terminal:
systemctl start test.timer

Terminal:
systemctl list-timers --all

Source:

https://unix.stackexchange.com/questions/198444/run-script-every-30-min-with-systemd


0 comentarios :