這篇文章主要為大家展示了“Linux中沒有rc.local文件怎么辦”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“Linux中沒有rc.local文件怎么辦”這篇文章吧。

比較新的Linux發(fā)行版已經(jīng)沒有rc.local文件了。因?yàn)橐呀?jīng)將其服務(wù)化了。
解決方法:
1、設(shè)置rc-local.service
sudo vim /etc/systemd/system/rc-local.service [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
2、激活rc-local.service
sudo systemctl enable rc-local.service
3、添加啟動(dòng)服務(wù)
手工創(chuàng)建或者拷貝已有的/etc/rc.local,并賦予執(zhí)行權(quán)限
#!/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. # 下面這條是要開機(jī)啟動(dòng)的命令 /home/selfcs/anaconda3/bin/python /home/selfcs/t.py > /home/selfcs/auto.log exit 0 #給予腳本執(zhí)行權(quán)限 sudo chmod +x /etc/rc.local
以上是“Linux中沒有rc.local文件怎么辦”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
網(wǎng)站題目:Linux中沒有rc.local文件怎么辦-創(chuàng)新互聯(lián)
網(wǎng)頁URL:http://www.chinadenli.net/article14/djosge.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、外貿(mào)建站、ChatGPT、網(wǎng)站設(shè)計(jì)、品牌網(wǎng)站建設(shè)、商城網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容