欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Linux中沒有rc.local文件的完美解決方法

 更新時間:2019年09月20日 10:18:19   作者:selfcs  
這篇文章主要介紹了Linux中沒有rc.local文件的解決方法,本文給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下

比較新的Linux發(fā)行版已經(jīng)沒有rc.local文件了。因為已經(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、添加啟動服務(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.

# 下面這條是要開機啟動的命令
/home/selfcs/anaconda3/bin/python /home/selfcs/t.py > /home/selfcs/auto.log 

exit 0
#給予腳本執(zhí)行權(quán)限
sudo chmod +x /etc/rc.local

總結(jié)

以上所述是小編給大家介紹的Linux中沒有rc.local文件的完美解決方法,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉(zhuǎn)載,煩請注明出處,謝謝!

相關(guān)文章

最新評論