Ubuntu 16.10开始不再使用initd管理系统,改用systemd,包括用systemctl命令来替换了service和chkconfig的功能。比如以前启动mysql服务用
sudo service mysql start
,现在用sudo systemctl start mysqld.service
。systemd 默认读取 /etc/systemd/system 下的配置文件,该目录下的文件会链接/lib/systemd/system/下的文件。
执行命令ls /lib/systemd/system
可以看到很多启动脚本,其中就有我们需要的rc.local.service
,打开脚本内容如下
# SPDX-License-Identifier: LGPL-2.1+
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of