هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
$ مستخدم عادي# بصلاحية root (أو مع sudo)
The quick answer
systemctl status nginx
systemctl restart nginx
systemctl reload nginx
systemctl enable --now nginx
systemctl disable --now nginx
systemctl is-active nginx; systemctl is-enabled nginx| Command | Effect |
|---|---|
start / stop | Now — not after a reboot. |
enable / disable | At boot — not now. |
enable --now / disable --now | Both at once. |
restart | Stop and start (short downtime; reads all changes). |
reload | The service rereads its config without stopping (if it supports it — nginx, sshd, haproxy, postgresql). |
Step by step
- Find the unit and read its status:
systemctl list-units --type=service --state=running
systemctl list-unit-files --type=service | grep -i ssh
systemctl status sshd
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: enabled)
Active: active (running) since Mon 2026-11-17 08:01:12 +03; 3h agoLoaded … enabled = starts at boot. Active: active (running) = runs now.
- After a config change: test the config if the service has a test command, then reload (or restart):
- See all failed services after a boot or an incident:
- Change a service the safe way — never edit files in
/usr/lib/systemd/system(updates overwrite them). Use an override:
systemctl edit nginx[Service]
Restart=on-failure
RestartSec=5
LimitNOFILE=65536systemctl edit reloads systemd for you. If you change unit files by hand: systemctl daemon-reload.
- Stop a service from ever starting (even as a dependency):
- Your own app as a service — a minimal unit:
[Unit]
Description=My app
After=network-online.target
[Service]
User=myapp
ExecStart=/opt/myapp/bin/myapp --port 8080
Restart=on-failure
[Install]
WantedBy=multi-user.targetCheck that it worked
Common problems
| Problem | Cause | Fix |
|---|---|---|
Unit nginx.service not found | Not installed, or another name. | systemctl list-unit-files | grep -i NAME; install the package. |
Job for X failed because the control process exited with error code | The service could not start (config, port, rights). | journalctl -xeu X; test the config; see "How to read the logs of a service". |
Unit X is masked | Someone masked it on purpose. | systemctl unmask X (if it should run). |
| Changes in the unit file are ignored | systemd did not reload. | systemctl daemon-reload, then restart. |
| Runs now but not after reboot | It was started, not enabled. | systemctl enable X. |
reload does nothing / not supported | The unit has no reload action. | Use restart (plan the short downtime). |
Go further
- Command pages: systemctl, journalctl, systemd-analyze.
- Next how-tos: Read and follow the logs of a service, Create a systemd timer, Kill a process that hangs, Create a systemd service for your app, Restart a service automatically when it crashes.
- Learn it for RHCSA: RHCSA — Services, RH124 — Services. Practise: Lab: services.
1What is the difference between start and enable?
start runs the service now; enable makes it start at boot. enable --now does both.
2How do you change a vendor service file without losing the change at the next update?
With an override: systemctl edit NAME (file in /etc/systemd/system/NAME.service.d/).