成都创新互联网站制作重庆分公司

Linux中的rc.local文件丢失了怎么办

这篇文章主要讲解了“Linux中的rc.local文件丢失了怎么办”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Linux中的rc.local文件丢失了怎么办”吧!

成都创新互联公司成都网站建设按需定制制作,是成都网站营销公司,为成都活动板房提供网站建设服务,有成熟的网站定制合作流程,提供网站定制设计服务:原型图制作、网站创意设计、前端HTML5制作、后台程序开发等。成都网站建设热线:18982081108

解决方法:

1、设置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、添加启动服务

手工创建或者拷贝已有的/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.
# 下面这条是要开机启动的命令/home/selfcs/anaconda3/bin/Python /home/selfcs/t.py > /home/selfcs/auto.log 
exit 0
#给予脚本执行权限
sudo chmod +x /etc/rc.local

感谢各位的阅读,以上就是“Linux中的rc.local文件丢失了怎么办”的内容了,经过本文的学习后,相信大家对Linux中的rc.local文件丢失了怎么办这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!


分享标题:Linux中的rc.local文件丢失了怎么办
URL标题:http://cxhlcq.com/article/gieoii.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部