Useful Commands/Service Management: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{| class="wikitable" ! 情境 || 指令 |- | 取得本地時間 || <source lang="bash">date</source> |- | 取得 UTC 時間 || <source lang="bash">date -u</source> |- | 取...") |
|||
| (23 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
== systemctl == | |||
{| class="wikitable" | {| class="wikitable" | ||
! | ! Purpose || Command | ||
|- | |- | ||
| | | Monitor || | ||
<syntaxhighlight lang="bash"> | |||
journalctl -u llama-swap -n 10 -f | |||
journalctl -u llama-swap --since "10:20" | |||
journalctl -u llama-swap --since "10 minutes ago" | |||
journalctl -u llama-swap --since today | |||
systemctl status llama-swap | |||
</syntaxhighlight> | |||
|- | |- | ||
| | | Setup || | ||
<syntaxhighlight lang="bash"> | |||
sudo systemctl disable llama-swap | |||
sudo systemctl daemon-reload | |||
sudo ln -s /home/xxx/yyy/llama-swap.service llama.service | |||
sudo systemctl enable llama-swap | |||
sudo systemctl daemon-reload | |||
</syntaxhighlight> | |||
|- | |- | ||
| | | Control || | ||
<syntaxhighlight lang="bash"> | |||
systemctl start nginx | |||
systemctl stop nginx | |||
systemctl reload nginx | |||
systemctl reload systemd-networkd | |||
</syntaxhighlight> | |||
|- | |- | ||
| | | List || | ||
| | <syntaxhighlight lang="bash"> | ||
systemctl -t service | |||
</syntaxhighlight> | |||
| | |} | ||
== Run Level == | |||
{| class="wikitable" | |||
! Target || ! Description | |||
|- | |- | ||
| | | multi-user.target || Multi-user mode (CLI) (Equivalent to Runlevel 3) | ||
|- | |- | ||
| | | graphical.target || Graphical mode (GUI) (Equivalent to Runlevel 5) | ||
|- | |- | ||
| | | rescue.target || Rescue mode (Equivalent to Runlevel 1) | ||
|- | |- | ||
| | | emergency.target || Emergency mode (Equivalent to Runlevel 0) | ||
|- | |- | ||
| | | reboot.target || Reboot | ||
|- | |- | ||
| | | poweroff.target || Power off | ||
|} | |} | ||
Latest revision as of 02:48, 10 September 2026
systemctl
| Purpose | Command |
|---|---|
| Monitor |
journalctl -u llama-swap -n 10 -f
journalctl -u llama-swap --since "10:20"
journalctl -u llama-swap --since "10 minutes ago"
journalctl -u llama-swap --since today
systemctl status llama-swap
|
| Setup |
sudo systemctl disable llama-swap
sudo systemctl daemon-reload
sudo ln -s /home/xxx/yyy/llama-swap.service llama.service
sudo systemctl enable llama-swap
sudo systemctl daemon-reload
|
| Control |
systemctl start nginx
systemctl stop nginx
systemctl reload nginx
systemctl reload systemd-networkd
|
| List |
systemctl -t service
|
Run Level
| Target | ! Description |
|---|---|
| multi-user.target | Multi-user mode (CLI) (Equivalent to Runlevel 3) |
| graphical.target | Graphical mode (GUI) (Equivalent to Runlevel 5) |
| rescue.target | Rescue mode (Equivalent to Runlevel 1) |
| emergency.target | Emergency mode (Equivalent to Runlevel 0) |
| reboot.target | Reboot |
| poweroff.target | Power off |