linux开机自动执行命令
linux开机自动执行命令/etc/rc.local
·
- /etc/rc.local是/etc/rc.d/rc.local的软链,像windos的快捷方式
- 开机自动执行的命令在此文件尾部exit 0 之前输入即可
- 给/etc/rc.local文件添加执行权限,chmod +x /etc/rc.local
[root@localhost ~]# cat /etc/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
service docker start
docker start mysql php nginx redis
exit 0
更多推荐
已为社区贡献2条内容
所有评论(0)