欢迎光临散文网 会员登陆 & 注册

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

2022-12-22 15:03 作者:信创技术联盟  | 我要投稿


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://www.cnxclm.com/read-3690-1.html,欢迎对信创感兴趣的朋友们一同到论坛相互讨论交流!


麒麟v10专业版本添加rc.local的方法的评论 (共 条)

分享到微博请遵守国家法律