Ubuntu 18.04 rc.local 设置开机自启动

Ubuntu 18.04默认进程启动管理已经切换至systemd,不在使用SysV。如果想像之前一样使用/etc/rc.local设置开机自启动,请如下设置

修改rc-local.service

/lib/systemd/system/rc-local.service新增:

 
  1. [Install]
  2. WantedBy=multi-user.target
  3. Alias=rc-local.service

设置开机自启动rc-local

  1. systemctl enable rc-local

创建/etc/rc.local

 
  1. cat > /etc/rc.local << EOF
  2. #!/bin/bash
  3. echo "test rc.local " > /tmp/rctest.log
  4. EOF

新增执行权限

  1. chmod +x /etc/rc.local

即可

相关文章:

  • 2022-02-12
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2022-03-02
  • 2022-03-08
  • 2022-12-23
猜你喜欢
  • 2022-01-03
  • 2022-01-15
  • 2021-06-23
  • 2021-12-10
  • 2021-12-23
  • 2021-12-23
相关资源
相似解决方案