CentOS7之开机自动执行脚本

新建脚本

#! /bin/bash
systemctl start docker.service
docker start fc6
docker start 34b
cd /root/prometheus-2.15.1.1.linux-amd64
nohup ./prometheus > prometheus.log 2>&1 &

执行权限

chmod +x startup.sh

提升/etc/rc.d/rc.local文件权限

chmod +x /etc/rc.d/rc.local

添加开机脚本

vim /etc/rc.d/rc.local
CentOS7之开机自动执行脚本_第1张图片

你可能感兴趣的:(服务器运维专栏,CentOS7,开机,自动)