diff --git "a/41 \351\231\210\345\200\251\345\200\251/20240619_\350\277\233\347\250\213\347\256\241\347\220\206.md" "b/41 \351\231\210\345\200\251\345\200\251/20240619_\350\277\233\347\250\213\347\256\241\347\220\206.md" index 17cabf33b6016d1fb419a9535e21fbf9247cdc74..32c6305ccac28d92c483eb34ead7d24762e76484 100644 --- "a/41 \351\231\210\345\200\251\345\200\251/20240619_\350\277\233\347\250\213\347\256\241\347\220\206.md" +++ "b/41 \351\231\210\345\200\251\345\200\251/20240619_\350\277\233\347\250\213\347\256\241\347\220\206.md" @@ -183,28 +183,3 @@ ``` - **ctrl+z : 挂起当前程序** - -## 服务管理 - -- **systemctl**命令 - - ```bash - systemctl [options] [command] [unit] - systemctl start - systemctl stop - ``` - - - options:选项 - - **-a**:显示所有的单位 - - **-p**:显示指定属性的值 - - **-H**:在远程主机上执行命令 - - command:必选参数 - - **start**:启动指定的单位 - - **stop**:停止指定的单位 - - **restart**:重启指定的单位 - - **reload**:重新加载指定的单位 - - **enable**:设置指定的单位在系统启动时自动启动 - - **disable**:设置指定的单位在系统启动时不自动启动 - - **status**:显示指定的单位的状态 - - **list-units**:列出所有的单位 - - **list-unit-files**:列出所有的单位文件 \ No newline at end of file diff --git "a/41 \351\231\210\345\200\251\345\200\251/20240622_\346\234\215\345\212\241\347\256\241\347\220\206.md" "b/41 \351\231\210\345\200\251\345\200\251/20240622_\346\234\215\345\212\241\347\256\241\347\220\206.md" new file mode 100644 index 0000000000000000000000000000000000000000..21f789c79d11bc821cbf577e6d19b2c982ec26d0 --- /dev/null +++ "b/41 \351\231\210\345\200\251\345\200\251/20240622_\346\234\215\345\212\241\347\256\241\347\220\206.md" @@ -0,0 +1,41 @@ +## 服务管理 + +Service 对 /etc/init.d 中的初始化系统文件进行操作,而 systemctl 对 /lib/systemd 中的文件进行操作。 + +- **(Systemd)systemctl**命令 + + ```bash + systemctl [options] [command] [unit] + systemctl 命令 服务(程序)名 + systemctl start + systemctl stop + systemctl list-dependencies [unit] --reverse // 反向追踪谁使用了这个服务单元 + ``` + + - options:选项 + - **-a**:显示所有的单位 + - **-p**:显示指定属性的值 + - **-H**:在远程主机上执行命令 + + - command:必选参数 + - **start**:启动指定的单位 + - **stop**:停止指定的单位 + - **restart**:重启指定的单位 + - **reload**:重新加载指定的单位 + - **enable**:设置指定的单位在系统启动时自动启动 + - **disable**:设置指定的单位在系统启动时不自动启动 + - **status**:显示指定的单位的状态 + + - **list-units**:列出所有的单位,查看当前启动服务 + - **list-unit-files**:列出所有的单位文件,查看已安装的服务 + - 还有很多,可用systemctl+tab查看 + +- **service**命令,与systemctl用法相似 + + ```bash + service 服务(程序)名 命令 + ``` + + + + \ No newline at end of file