Debian 10 把 rc.local 加回來

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

首先我們需要先自行創建 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.
本文来自投稿,不代表本站立场,如若转载,请注明出处:
Debian 10 可以直接於 vim 中使用複製貼上
« 上一篇 04-10
Debian 10 加入 sudo
下一篇 » 05-19