0%

写个守护进程(daemon)

init.d已去,systemctl当立。

守护进程(daemon):开机后默默执行的程序,关机前默默执行的程序

在systemctl配置文件里面修改:

1.systemctl的service服务可以存在两个位置

1./usr/lib/systmd/system/

2./etc/systemd/system/(一般给root用)

2.写配置文件

1.[unit]守护进程的启动顺序与依赖的关系

2.[service]守护进程的行为

3.[install]本守护进程阶段

3.systemctl的守护进程重新启动

1
sudo systemctl daemon-reload

4.执行

立马执行:

1
sudo systemctl start xxx.service 

开机自启动:

1
sudo systemctl enable xxx.service

这个博客写的很清晰!

```