centos7 创建服务自启动脚本

3月 20, 2019 |

touch /etc/systemd/system/name.service
chmod 664 /etc/systemd/system/name.service


systemctl daemon-reload
systemctl start name.service

Type=forking vs Type=simple
Type=simple 表示服务是一个简单的服务,没有实现守护进程(daemonize) 功能,所以systemd需要将其变成守护进程(daemonize),比如memcached.service
Type=forking 表示服务直接实现了daemonize功能,比如MySQL.service

参考文档
Creating Custom Unit Files

Posted in: Linux

Comments are closed.