1. ubuntu18.04 默认不带有rc.local的配置
# 1.创建软连接 -- root用户ln -sf /lib/systemd/system/rc-local.service /etc/systemd/system/rc-local.service# 添加一句命令行 -- root用户cat >>/etc/systemd/system/rc-local.service<<EOF[Install]WantedBy=multi-user.targetAlias=rc-local.serviceEOF# 2.创建rc.local文件并 赋权touch /etc/rc.local && chmod 755 /etc/rc.local# 3.导入必要的语句cat >>/etc/rc.local<<EOF#!/bin/bash/bin/bash /etc/rsync/rsync.init.sh > /dev/null 2>&1 &/usr/local/qif/nginx/sbin/nginx -c /usr/local/qif/nginx/conf/nginx.conf/bin/bash /home/qif/stream_new/start.sh daemon > /dev/nullexit 0EOF
# 自启动脚本#!/bin/bash -e/usr/local/qif/nginx/sbin/nginx -c /usr/local/qif/nginx/conf/nginx.confcd /home/qif/stream_new && ./daemon.sh > /dev/nullexit 0