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.target
Alias=rc-local.service
EOF
# 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/null
exit 0
EOF
# 自启动脚本
#!/bin/bash -e
/usr/local/qif/nginx/sbin/nginx -c /usr/local/qif/nginx/conf/nginx.conf
cd /home/qif/stream_new && ./daemon.sh > /dev/null
exit 0