|
1、新建自定义脚本start.sh
#!/bin/bash
# This is start hgfs
cd /opt/sh/start
sh ./hgfs.sh
2、定义需要执行的脚本,如(共享文件):hgfs.sh
#!/bin/bash
# This is start hgfs
sudo vmhgfs-fuse .host:/ /mnt/hgfs
目录结构

3、执行命令:
cd etc/rc.d/
4、编辑rc.local文件
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
cd /opt/sh/start
sh ./start.sh
exit 0
5、赋予权限
chmod +777 rc.local
6、查看rc.local状态是否正常
systemctl status rc-local
|