From d0d15515707688cd987e846ddeb27643a36da51f Mon Sep 17 00:00:00 2001 From: chicrobot Date: Wed, 21 Jan 2026 17:18:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20e1=5Flinux=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0systemd=E6=9C=8D=E5=8A=A1.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- e1_linux添加systemd服务.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/e1_linux添加systemd服务.md b/e1_linux添加systemd服务.md index d30ab97..555a5ef 100644 --- a/e1_linux添加systemd服务.md +++ b/e1_linux添加systemd服务.md @@ -32,31 +32,31 @@ WantedBy=multi-user.target sudo systemctl daemon-reload # 开机自启(可选) -sudo systemctl enable myblog.service +sudo systemctl enable pykins.service # 启动服务 -sudo systemctl start myblog.service +sudo systemctl start pykins.service ``` ## 相关命令 ``` # 启动 -sudo systemctl start myblog +sudo systemctl start pykins # 停止 -sudo systemctl stop myblog +sudo systemctl stop pykins # 重启 -sudo systemctl restart myblog +sudo systemctl restart pykins # 查看状态 -sudo systemctl status myblog +sudo systemctl status pykins ``` 查看日志 ``` # 实时跟踪日志(类似 tail -f) -sudo journalctl -u myapp.service -f +sudo journalctl -u pykins.service -f # 查看该服务的所有日志 -sudo journalctl -u myapp.service +sudo journalctl -u pykins.service # 查看今天的日志 -sudo journalctl -u myapp.service --since today +sudo journalctl -u pykins.service --since today # 按 SyslogIdentifier 过滤(需配置该项) -sudo journalctl -t myapp +sudo journalctl -t pykins ```