service 命令用于管理 Ubuntu 系统服务。
这个命令不是在所有 Linux 发行版本中都有。 主要是在 Redhat、Fedora、Mandriva 和 Centos 中。 Ubuntu 新版本有引入。
Ubuntu 老版本要实现类似功能,语法类似这样:
/etc/init.d/nginx start|stop|restart
Basic Usage Detailed Usage
service nginx start
基本语法
service < option>| --status-all | [ service_name [ command | --full-restart ] ]
| Function | 命令 | 文字解释 | 示例 | 示例解释 |
|---|---|---|---|---|
| 启动 | service service_name start | 启动名为 service_name 的服务 | ||
| 停止 | service service_name stop | 停止名为 service_name 的服务 | ||
| 重启 | service service_name restart | 重启名为 service_name 的服务 | ||
| 重载 | service service_name reload | 重载名为 service_name 的服务 | service nginx reload | 重载 nginx 服务 |
| 查看 | service service_name status | 查看名为 service_name 的服务状态 | service nginx status | 查看 nginx 服务状态 |
| 帮助 | shred --help | 展示帮助信息 |
Copyright Notice: This article is an exclusive original manuscript, copyright belongs to Happy Digits Software , shall not be reproduced without permission.