Systemd Service - swkim0128/PARA GitHub Wiki
Author: velog.io
Full Title: Systemd Service
Category: #articles
Document Tags: linux
Summary: The text explains how to create and manage systemd services, using ssh.service as an example. It covers key sections like [Unit], [Service], and [Install], detailing their purposes and configurations. Additionally, it illustrates how to enable and start services while explaining dependencies and service types.
URL: https://velog.io/@markyang92/systemd-timer
μλΉμ€ μμ Target Unit μ€μ λ° λΆν
μ Unitμ΄ enable, disable μ μν μΉμ
(View Highlight )
Note: [install] μΉμ
κ΄λ ¨ μ€λͺ
WantedBy : Unitμ΄ μ΄λ»κ² νμ±ν(enable)λ κ²μΈμ§μ λν λΆλΆ (View Highlight )
Note: Install μΉμ
, WantedBy μ€μ μ€λͺ
$ sudo systemctl enable
λͺ
λ Ήμ΄λ‘ Unit μ enable ν λ, λ±λ‘μ νμν μ λ μ μ§μ νλ€.
β’ Dependency CheckλΌ μκ°
β’ **/etc/systemd/system/μ§λͺ
.target.wants
**μ λ€μ΄κ°λ€.
β’ λΆν
μ, μν .wantsμ λ°λΌ μ€νλκ²νλ€. (View Highlight )
Note: Install μΉμ
, WantedBy μ€μ μ€λͺ
2
μ€μ ssh.service
μ μμΉ : /usr/lib/systemd/system/ssh.service
(View Highlight )
Note: multi-user.targetμΌλ‘ μ€μ ν κ²½μ°, λ±λ‘λλ μμΉ
3-1. /etc/systemd/system/multi-user.target.wants/
μ ssh.service μννΈλ§ν¬ μμ±
3-2. /etc/systemd/system/
μ systemd
κ° μμλ¨Ήμ μ μκ², Alias=sshd.service
λλ‘
sshd.service κ° μμ±λμ΄, sshd λΌλ μ΄λ¦μΌλ‘λ μ κ·Ό ν μ μλ κ²μ (View Highlight )
Note: μ€μ μμ±μμΉ : /usr/lib/systemd/system/
μννΈλ§ν¬ μμ±μμΉ : /etc/systemd/system/multi-user.tartget.wants
Alias λ§ν¬ μμ±μμΉ : /etc/systemd/system
Alias
β’ [Install]
β’ Alias: Unit alias μ΄λ¦ μ§μ
β’ $ sudo systemctl enable 'alias'
μ κ·Ό κ°λ₯
β’ alias μ΄λ¦μ Unit νμΌ νμ₯μλ₯Ό κ°μ§κ³ μμ΄μΌνλ€.
β’ service, socket, mount, swap λ±.
β’ e.g.
β’ μλΉμ€ μ΄λ¦: httpd.service μ,
Alias=[Alias Name].service
(View Highlight )
β οΈ **GitHub.com Fallback** β οΈ
ποΈ Page Index for this GitHub Wiki