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
Last revisionBoth sides next revision
doc:appunti:linux:sa:systemd [2018/10/08 12:56] – [Verifica Servizi] niccolodoc:appunti:linux:sa:systemd [2023/12/13 12:36] – [Sostituto di rc.local] niccolo
Line 167: Line 167:
 systemctl --all list-dependencies ntp.service systemctl --all list-dependencies ntp.service
 </code> </code>
 +
 +===== Alternatriva 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.txt · Last modified: 2023/12/13 12:37 by niccolo