Debian 10 把 rc.local 加回來

本文阅读 1 分钟
首页 Debian,Linux 正文

首先我們需要先自行創建 rc.local 檔案,可直接使用下面代碼快速建立

  1. cat <<EOF >/etc/rc.local
  2. #!/bin/sh -e
  3. #
  4. # rc.local
  5. #
  6. # This script is executed at the end of each multiuser runlevel.
  7. # Make sure that the script will "exit 0" on success or any other
  8. # value on error.
  9. #
  10. # In order to enable or disable this script just change the execution
  11. # bits.
  12. #
  13. # By default this script does nothing.
  14. exit 0
  15. EOF

接著我們賦予 rc.local 可執行的權限

  1. chmod +x /etc/rc.local

再來就可以啟動 rc-local 服務了

  1. systemctl start rc-local

觀察看看是否有正確運作

  1. systemctl status rc-local
  2. ● rc-local.service - /etc/rc.local Compatibility
  3. Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
  4. Drop-In: /usr/lib/systemd/system/rc-local.service.d
  5. └─debian.conf
  6. Active: active (exited) since Fri 2020-04-10 13:02:28 CST; 8s ago
  7. Docs: man:systemd-rc-local-generator(8)
  8. Process: 6407 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)
  9. Apr 10 13:02:28 backup systemd[1]: Starting /etc/rc.local Compatibility...
  10. Apr 10 13:02:28 backup systemd[1]: Started /etc/rc.local Compatibility.
本文来自投稿,不代表本站立场,如若转载,请注明出处:
Debian 10 可以直接於 vim 中使用複製貼上
« 上一篇 04-10
Debian 10 加入 sudo
下一篇 » 05-19