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/10/08 12:56] – [Timeout in attesa di un device] niccolodoc:appunti:linux:sa:systemd [2023/12/13 12:37] (current) – [Alternatriva allo script rc.local] niccolo
Line 156: Line 156:
 Alcuni comandi utili per **verificare il funzionamento** dei servizi gestiti da **systemd**. Alcuni comandi utili per **verificare il funzionamento** dei servizi gestiti da **systemd**.
  
-Mostra lo stato di tutti i servizi e di tutte le unit+Mostra lo stato di tutti i **servizi** e di tutte le **unit**:
  
 <code> <code>
Line 162: Line 162:
 </code> </code>
  
-Mostra le unit //required// e //wanted// dalla unit specificata:+Mostra le **unit** //required// e //wanted// dalla unit specificata:
  
 <code> <code>
 systemctl --all list-dependencies ntp.service systemctl --all list-dependencies ntp.service
 </code> </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 ===== ===== Riferimenti web =====
doc/appunti/linux/sa/systemd.1538996178.txt.gz · Last modified: 2018/10/08 12:56 by niccolo