Outils pour utilisateurs

Outils du site


linux:systemd (lu 1262 fois)

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

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://lea-linux.org/documentations/systemd
  
 +
 +===== Lire les log =====
 +
 +--- source: https://www.linuxtricks.fr/wiki/utiliser-journalctl-les-logs-de-systemd
 +
 +  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 /lib/systemd/system/certbot.timer
 +[Unit]
 +Description=Run certbot twice daily
 +
 +[Timer]
 +OnCalendar=*-*-* 00,12:00:00
 +RandomizedDelaySec=3600
 +Persistent=true
 +
 +[Install]
 +WantedBy=timers.target
 +</code>
 +
 +Script venant de l'install par centos
 +<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
 +
 +</code>
 +
 +
 +
 +
 +and certbot.service will execute the renew command.
 +
 +
 +<code bash>
 +# cat /lib/systemd/system/certbot.service
 +[Unit]
 +Description=Certbot
 +Documentation=file:///usr/share/doc/python-certbot-doc/html/index.html
 +Documentation=https://letsencrypt.readthedocs.io/en/latest/
 +[Service]
 +Type=oneshot
 +ExecStart=/usr/bin/certbot -q renew
 +PrivateTmp=true
 +</code>
 +
 +Script venant de l'install par centos
 +<code bash>
 +[Unit]
 +Description=This service automatically renews any certbot certificates found
 +
 +[Service]
 +EnvironmentFile=/etc/sysconfig/certbot
 +Type=oneshot
 +ExecStart=/usr/bin/certbot renew $PRE_HOOK $POST_HOOK $RENEW_HOOK $CERTBOT_ARGS
 +</code>
 +
 +
 +Surtout de pas oublier d'activer ce timer
 +  systemctl enable certbot-renew.timer
 +  systemctl start certbot-renew.timer
 +  systemctl status certbot-renew.timer
linux/systemd.1494839989.txt.gz · Dernière modification: 15-05-2017 11:19 de edmc73