User Tools

Site Tools


doc:appunti:linux:sa:systemd

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:linux:sa:systemd [2018/01/12 12:29] – [Systemd] niccolodoc:appunti:linux:sa:systemd [2023/12/13 12:37] (current) – [Alternatriva allo script rc.local] niccolo
Line 144: Line 144:
  
 Non è necessario modificare il contenuto di questa directory, si può fare un override creando il link simbolico opportuno nella directory **/etc/systemd/system/**. Invece del **reboot.target** si utilizza l'esistente **poweroff.target**. Non è necessario modificare il contenuto di questa directory, si può fare un override creando il link simbolico opportuno nella directory **/etc/systemd/system/**. Invece del **reboot.target** si utilizza l'esistente **poweroff.target**.
-===== Riferimenti web =====+===== Timeout in attesa di un device =====
  
 +Può capitare che il processo di **bootstrap fallisce** perché un device elencato in **/etc/fstab** non risulta disponibile nei tempi richiesti (lentezza del disco? CPU troppo veloce?). In questi casi si può aggiungere in /etc/fstab una opzione di montaggio:
 +
 +<file>
 +/dev/sda3  /home  ext4  defaults,x-systemd.device-timeout=300s  0  2
 +</file>
 +
 +===== Verifica Servizi =====
 +
 +Alcuni comandi utili per **verificare il funzionamento** dei servizi gestiti da **systemd**.
 +
 +Mostra lo stato di tutti i **servizi** e di tutte le **unit**:
 +
 +<code>
 +systemctl --all --full status
 +</code>
 +
 +Mostra le **unit** //required// e //wanted// dalla unit specificata:
 +
 +<code>
 +systemctl --all list-dependencies ntp.service
 +</code>
 +
 +===== Alternativa allo script rc.local =====
 +
 +Come eseguire uno script all'avvio di un sisetma Systemd.
 +
 +Creare una unit Systemd **/etc/systemd/system/my-startup.service**:
 +
 +<file>
 +# /etc/systemd/system/my-startup.service
 +#
 +# Service executed once the system has reached the multi-user status.
 +#
 +#  Type=oneshot         The unit is up after the main process exits.
 +#  RemainAfterExit=yes  The service shall be considered active even
 +#                       when all its processes exited.
 +#
 +# Eanble the service with:
 +#   systemctl enable my-startup.service
 +
 +[Service]
 +Type=oneshot
 +RemainAfterExit=yes
 +ExecStart=/usr/local/sbin/my-startup-script
 +
 +[Install]
 +WantedBy=multi-user.target
 +</file>
 +
 +Abilitare la unit e predisporre lo script **/usr/local/sbin/my-startup-script**.
 +
 +===== Riferimenti web =====
  
   * **[[https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files|   * **[[https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files|
 Understanding Systemd Units and Unit Files]]** Understanding Systemd Units and Unit Files]]**
   * **[[https://askubuntu.com/questions/710420/why-are-some-systemd-services-in-the-masked-state|Why are some systemd services in the “masked” state?]]**   * **[[https://askubuntu.com/questions/710420/why-are-some-systemd-services-in-the-masked-state|Why are some systemd services in the “masked” state?]]**
doc/appunti/linux/sa/systemd.1515756578.txt.gz · Last modified: 2018/01/12 12:29 by niccolo