分享

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

Error 2022-6-30 12:00:47 发表于 原创 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 3 2104
1、切换至root,建立rc-local.service文件
  1. sudo su
  2. vim /etc/systemd/system/rc-local.service
复制代码
2、在里面写入如下内容
  1. [Unit]
  2. Description=/etc/rc.local Compatibility
  3. ConditionPathExists=/etc/rc.local
  4. [Service]
  5. Type=forking
  6. ExecStart=/etc/rc.local start
  7. TimeoutSec=0
  8. StandardOutput=tty
  9. RemainAfterExit=yes
  10. SysVStartPriority=99
  11. [Install]
  12. WantedBy=multi-user.target
复制代码
3、然后在创建文件rc.local
  1. vim /etc/rc.local
复制代码
4、里面写入下面内容(红色部分就是开机所要执行的脚本和命令)
  1. #!/bin/sh -e

  2. sleep 3
  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
  4. 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
  5. exit 0
复制代码
5、加上权限
  1. chmod +x /etc/rc.local
复制代码
6、启动服务
  1. systemctl enable rc-local
复制代码
7、开启服务
  1. systemctl start rc-local.service
复制代码


评分

参与人数 1活跃值 +100 +10 收起 理由
lemon + 100 + 10 很给力!!

查看全部评分

版权说明:论坛帖子主题均由合作第三方提供并上传,若内容存在侵权,请进行举报

已有(3)人评论

跳转到指定楼层
lemon实名认证 手机认证 发表于 2022-7-5 14:38:29 来自 中国广东东莞
好帖多支持!
fycjames实名认证 手机认证 发表于 2022-7-14 09:41:22 来自 中国浙江衢州
卡了有什么用吗?
ggg实名认证 手机认证 发表于 2022-8-6 20:49:24 来自 中国广西桂林
辛苦了!!!!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

联系在线客服