可以把 需要设置为开机自执行的脚本放到 配置文件:/etc/rc.local ,参考内容如下:
/etc/rc.local
#!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /var/lock/subsys/local /etc/init.d/nginx start /alidata/server/php/sbin/php-fpm -c /alidata/server/php/etc/php.ini -y /alidata/server/php/etc/php-fpm.conf /etc/init.d/vsftpd start /alidata/www/go/gocron/run.sh start
相关文章:
(总结)/etc/rc.d/rc.local 与 /etc/profile .bash_profile .bashrc 文件执行顺序
CentOS中/etc/rc.local和/etc/rc.d/rc.local的区别
CentOS7 /etc/rc.local需要chmod +x /etc/rc.d/rc.local