10 04 2020

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

cat <<EOF >/etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0
EOF

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

chmod +x /etc/rc.local

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

systemctl start rc-local

觀察看看是否有正確運作

systemctl status rc-local
● rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
  Drop-In: /usr/lib/systemd/system/rc-local.service.d
   └─debian.conf
   Active: active (exited) since Fri 2020-04-10 13:02:28 CST; 8s ago
 Docs: man:systemd-rc-local-generator(8)
  Process: 6407 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)
Apr 10 13:02:28 backup systemd[1]: Starting /etc/rc.local Compatibility...
Apr 10 13:02:28 backup systemd[1]: Started /etc/rc.local Compatibility.
延伸閱讀
  1. Debian 10 + Bind9 9.16.3 編譯安裝
  2. 什麼是原生 IP?
  3. Debian 10 加入 sudo
  4. Debian 10 可以直接於 vim 中使用複製貼上
  5. 在 Debian 10 安裝 Wireguard (安全又快速的 VPN 隧道)
  6. 在 Debian 10 中增加 4G 連網 (本篇使用 wvdial)
更多閱讀
  1. 上一篇:Debian 10 可以直接於 vim 中使用複製貼上
  2. 下一篇:Debian 10 加入 sudo
發表評論 搶頭香
評論已經關閉