enhance:为systemctl文章增加内容。
This commit is contained in:
parent
084acb952a
commit
a2b6019eae
|
@ -258,4 +258,24 @@ Install区块是被`systemctl enable`和`systemctl diasble`命令使用确定Uni
|
|||
|
||||
- `Alias`,定义Unit的别名。Unit的别名可以在其他的Unit定义文件中使用,但是要求一个Unit的别名必须拥有相同的后缀。并且如果一个Unit拥有多个别名,那么在执行`systemctl enable`命令的时候,将会创建多个符号链接。
|
||||
- `WantedBy`,`RequiredBy`,会在`.wants`和`.requires`命名的Target目录中创建当前Unit的符号链接,使当前Unit可以被指定的Target所包含。
|
||||
- `Also`,设置与当前Unit一同被安装和卸载的Unit。
|
||||
- `Also`,设置与当前Unit一同被安装和卸载的Unit。
|
||||
|
||||
## 常见问题
|
||||
|
||||
### 设置的服务在启动的时候报`Default-Start contains no runlevels`
|
||||
|
||||
这种错误在比较旧的Linux系统中很少出现,反而在比较新的Linux系统中更容易出现。一旦出现了这种错误,服务将不会启动。但其实这种错误也十分容易解决,这种错误一般表示服务的启动脚本中没有定义`Default-Start`所可以使用的`runlevel`。
|
||||
|
||||
要解决这个错误,只需要在服务的启动脚本开头的位置加入以下代码即可。
|
||||
|
||||
```bash
|
||||
### BEGIN INIT INFO
|
||||
# Provides: service-name
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description:
|
||||
# Description:
|
||||
### END INIT INFO
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue
Block a user