Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
linux:systemd [15-05-2017 11:19] edmc73 créée |
linux:systemd [07-10-2019 10:06] (Version actuelle) edmc73 |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
====== SystemD ====== | ====== SystemD ====== | ||
+ | Une belle doc en français => https:// | ||
+ | |||
+ | ===== Lire les log ===== | ||
+ | |||
+ | --- source: https:// | ||
+ | |||
+ | journalctl | ||
+ | comme tail -f | ||
+ | journalctl -f | ||
+ | |||
+ | Filtrer par service | ||
+ | journalctl -u crond | ||
+ | |||
+ | |||
+ | ===== Timer ===== | ||
Lister les timers | Lister les timers | ||
systemctl list-timers --all | systemctl list-timers --all | ||
+ | |||
+ | Exemple d'un timer | ||
+ | |||
+ | certbot.timer will execute the certbot.service at 12 am and 12 pm. | ||
+ | |||
+ | <code bash> | ||
+ | # cat / | ||
+ | [Unit] | ||
+ | Description=Run certbot twice daily | ||
+ | |||
+ | [Timer] | ||
+ | OnCalendar=*-*-* 00,12:00:00 | ||
+ | RandomizedDelaySec=3600 | ||
+ | Persistent=true | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=timers.target | ||
+ | </ | ||
+ | |||
+ | Script venant de l' | ||
+ | <code bash> | ||
+ | [Unit] | ||
+ | Description=This is the timer to set the schedule for automated renewals | ||
+ | |||
+ | [Timer] | ||
+ | OnCalendar=daily | ||
+ | RandomizedDelaySec=6hours | ||
+ | Persistent=true | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=timers.target | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | and certbot.service will execute the renew command. | ||
+ | |||
+ | |||
+ | <code bash> | ||
+ | # cat / | ||
+ | [Unit] | ||
+ | Description=Certbot | ||
+ | Documentation=file:/// | ||
+ | Documentation=https:// | ||
+ | [Service] | ||
+ | Type=oneshot | ||
+ | ExecStart=/ | ||
+ | PrivateTmp=true | ||
+ | </ | ||
+ | |||
+ | Script venant de l' | ||
+ | <code bash> | ||
+ | [Unit] | ||
+ | Description=This service automatically renews any certbot certificates found | ||
+ | |||
+ | [Service] | ||
+ | EnvironmentFile=/ | ||
+ | Type=oneshot | ||
+ | ExecStart=/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | Surtout de pas oublier d' | ||
+ | systemctl enable certbot-renew.timer | ||
+ | systemctl start certbot-renew.timer | ||
+ | systemctl status certbot-renew.timer |