好男人视频社区,久久99国产精品尤物,大宫凉香电影,国外巨g乳熟妇av无码,天天日天天舔天天操,久久综合久色综合97婷婷,99久久久成人国产精品 ,4438亚洲最大色情网

在Ubuntu 18.04系統(tǒng)中設(shè)置開機啟動腳本的方法

/ 0評 / 0贊

在Ubuntu 18.04系統(tǒng)不能像其它Ubuntu一樣采用編輯rc.local文件來設(shè)置開機啟動腳本,你可以通過下面的步驟設(shè)置后使rc.local文件可用。請按以下步驟操作。

 

1、建立rc-local.service文件

運行命令:

sudo vi /etc/systemd/system/rc-local.service

 

2、將下面代碼復(fù)制到rc-local.service文件中

在上面建議rc-local.service文件后復(fù)制下面代碼到該文件中:

[Unit]

Description=/etc/rc.local Compatibility

ConditionPathExists=/etc/rc.local

[Service]

Type=forking

ExecStart=/etc/rc.local start

TimeoutSec=0

StandardOutput=tty

RemainAfterExit=yes

SysVStartPriority=99

[Install]

WantedBy=multi-user.target

 

3、創(chuàng)建文件rc.local

運行命令:

sudo vi /etc/rc.local

 

4、將下面代碼復(fù)制到rc.local文件

把下面代碼復(fù)制到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.

echo "看到這行字,說明添加自啟動腳本成功。" > /usr/local/test.log

exit 0

 

5、給rc.local加上權(quán)限

運行命令:

sudo chmod +x /etc/rc.local

 

6、開啟服務(wù)

運行命令:

sudo systemctl enable rc-local

 

7、啟動服務(wù)并檢查狀態(tài)

直接運行以下兩個命令:

sudo systemctl start rc-local.service

sudo systemctl status rc-local.service

 

8、重啟并檢查test.log文件

做完以上七個步驟就重新啟動系統(tǒng),運行以下命令檢查test.log文件:

cat /usr/local/test.log

 

結(jié)語

如果能看到test.log文件的內(nèi)容,就說明上面的設(shè)置成功了。現(xiàn)在可以通過編輯rc.local文件的方法來設(shè)置啟動腳本了。

建偉

發(fā)表評論

您的電子郵箱地址不會被公開。

這個站點使用 Akismet 來減少垃圾評論。了解你的評論數(shù)據(jù)如何被處理。