原创 麒麟v10专业版本添加rc.local的方法

2022-12-22 14:18 1960 7 7 分类: 物联网
1、切换至root,建立rc-local.service文件
sudo su
  • vim /etc/systemd/system/rc-local.service
  • 复制代码



    2、在里面写入如下内容
    [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、然后在创建文件rc.local
    vim /etc/rc.local
    复制代码



    4、里面写入下面内容(红色部分就是开机所要执行的脚本和命令) 
    #!/bin/sh -e
  • sleep 3
  • mount -t cifs -o iocharset=utf8,username=your_username,password=your_password,uid=1000,gid=1000 //192.168.123.1/软件 /home/kylin/桌面/share_test
  • mount -t cifs -o iocharset=utf8,username=your_username,password=your_password,vers=1.0 //192.168.123.1/7F-file-62 /home/kylin/桌面/share_test
  • exit 0
  • 复制代码



    5、加上权限
    chmod +x /etc/rc.local
    复制代码



    6、启动服务
    systemctl enable rc-local
    复制代码



    7、开启服务
    systemctl start rc-local.service
    复制代码




    以上内容来源于技术论坛“信创技术联盟”,欢迎对信创感兴趣的朋友们一同到论坛相互讨论交流!

    作者: 信创技术联盟, 来源:面包板社区

    链接: https://mbb.eet-china.com/blog/uid-me-4027494.html

    版权声明:本文为博主原创,未经本人允许,禁止转载!

    PARTNER CONTENT

    文章评论0条评论)

    登录后参与讨论
    我要评论
    0
    7
    关闭 站长推荐上一条 /3 下一条