Skip to content

playlist

Units

Any entity managed by systemd >[!example]- >Pasted_image_20240514192234.png

systemd_ordering

Location

  • /lib/systemd/systemd standard systmed unit files
  • /usr/lib/systmed/system for locally installed packages (via apt-get)
  • /run/systemd/systemd transient unit files
  • /etc/systemd/system custom unit files

Systemd targets

Way of managing relation between units It’s basically groups processor on phases and start them in a correct order

systemctl list-units --type: target
  • Target types
    • Service units: These represent system services.
    • Target units: These are used to group units and act as synchronization points during boot-up.
    • Device units: These represent devices in the system.
    • Mount units: These define mount points for file systems.
    • Socket units: These represent inter-process communication sockets.
    • Timer units: These define timer-based activation of other units.
    • Path units: These trigger activation of other units based on file system events.
    • Snapshot units: These are used to save the state of the systemd manager.
  • Last state is multi-user.target

u can move between the targets

*!!This will rollback to a given target!!

systemctl isolate sysinit.target

Systemd procedures

[!bug] Always execute the systemctl daemon-reload command After creating new unit files or modifying existing unit files. systemctl deamon-reload

  • Mask Unmask Blocks the service u can’t start it or enable ,it creates a service that points to the devnull

  • Reload service Try to reload the config and apply changes

  • Restart Service Close the program and re-run it without the check

New way

sudo systemctl restart *service*

Old way

sudo service *name* restart 

service

See what was dirscly when the unit was started

Example ssh

systemd-analyze critical-chain ssh
systemctl cat ssh

Configuration

[!example]- Docs configuration Pasted_image_20240514205706.png

Systemd Timers

[!example] Pasted_image_20240514231948.png

Systemd youtube

Restart

# ls /var/log/journal 
systemctl restart systemd-journald.service 
Important * by restarting the systemd-journald , you 'll loose all the logging of the current session so it's recommended to do the following cmd :
killall -USR1 systemd-journald 


Cronetab At init