Systemd - Systemctl

一、常用命令

这个里面包含了Systemd中的一些配置信息

以下列举出来的只是SystemD中对于Systemctl的一小部分命令,下来命令中的xxx.service服务在/etc/systemd/system中设置:
1. 启动服务:systemctl start xxx.service
2. 关闭服务:systemctl stop xxx.service
3. 重启服务:systemctl restart xxx.service
4. 重启服务:systemctl restart xxx.service
5. 在开机时启用服务:systemctl enable xxx.service
6. 在开机时禁用服务:systemctl disable xxx.service
7. 查看服务是否开机启动:systemctl is-enabled xxx.service
8. 查看已启动的服务列表:systemctl list-unit-files|grep enabled(可以查询配置好的所有service服务是否开启)
9. 查看启动失败的服务列表:systemctl --failed
10. 重载系统服务:systemctl daemon-reload(主要是)

二、特性

重启检测限制
1. StartLimitIntervalSec=设置限制时长,10秒,在system.conf下的DefaultStartLimitInterval是表示其默认值
2. StartLimitBurst=设置次数,5次,在system.conf下的DefaultStartLimitBurst是表示其默认值
3. 默认值为10秒内允许启动5次
4. 若需要某个服务单独设置的话,则在服务中的[service]标签下设置StartLimitIntervalSec和StartLimitBurst分别为需要设置的时间和次数

服务重启
1. 在服务进行结束后,服务会自动的将其重启,比如说在服务被人为手动的kill后,或者服务崩溃导致进程结束等等原因时,服务会将其自动重启,避免需要人为的实时去手动重启的局面,便于维护。

例子:test.service

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值