Linux中没有rc.local文件该怎么解决

    Linux   中没有rc.local文件的解决方法是什么呢?这应该是很多工程师比较头疼的问题,下面就给大家例举几个解决办法。

比较新的Linux发行版已经没有rc.local文件了。因为已经将其服务化了。

 Linux中没有rc.local文件该怎么解决_设计制作_模拟技术

解决方法:

1、设置rc-local.service

sudo vim /etc/sys     te   md/system/rc-local.service

[Unit]

Deion=/etc/rc.local Compa     ti   bility

Condi  TI onPathExists=/etc/rc.local

[Service]

Type=forking

ExecStart=/etc/rc.local start

 TI meoutSec=0

StandardOutput=tty

Rem     ai   nAfterExit=yes

SysVStartPriority=99

[Install]

WantedBy=mul  TI -user.target

2、激活rc-local.service

sudo syst     emc   tl enable rc-local.service

3、添加启动服务

手工创建或者拷贝已有的/etc/rc.local,并赋予执行权限

#!/bin/sh -e

#

# rc.local

#

# This is executed at the end of each mul  TI user runlevel.

# Make sure that the will “exit 0” on success or any other

# value on error.

#

# In order to enable or disable this just change the execution

# bits.

#

# By default this does nothing.

# 下面这条是要开机启动的命令

/home/selfcs/anaconda3/bin/     Python   /home/selfcs/t.py 》 /home/selfcs/auto.log

exit 0

#给予脚本执行权限

sudo chmod +x /etc/rc.local

责任编辑:ct

7
49
0
50

相关资讯

  1. 1、如何在一淘查看商品的价格走势?一淘查看商品价格走势的方法2410
  2. 2、爱奇艺怎么设置弹幕显示区域?6个步骤让你轻松设置弹幕区域!1799
  3. 3、Win10电脑的任务栏浅色模式无法勾选怎么办?4381
  4. 4、Win10如何更改C盘默认安装?Win10更改C盘默认安装的方法967
  5. 5、word2019如何设置纸张方向?word2019设置纸张方向的操作步骤2591
  6. 6、神漫画APP怎么点赞漫画章节?神漫画APP点赞漫画章节的方法960
  7. 7、Win10个性化设置闪退怎么解决?教你一招快速解决个性化闪退问题4359
  8. 8、动动计步器怎样上传微信运动?完成绑定了解一下3030
  9. 9、迅捷CAD编辑器怎么把直径标注的文字设置成水平?2946
  10. 10、微信电脑版3.0.0内测更新:批量删除好友!217
全部评论(0)
我也有话说
0
收藏
点赞
顶部