启动脚本
代码语言:javascript复制vi /usr/local/consul/start.sh
#!/bin/bash
/usr/local/bin/consul agent -config-dir=/etc/consul.d > /data/consul/consul.log
启动服务
代码语言:javascript复制vi /usr/lib/systemd/system/consul.service
[Unit]
Description=consul
After=network.target
[Service]
ExecStart=/usr/local/consul/start.sh
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target
添加执行权限 chmod x /usr/local/consul/start.sh
启动 systemctl start consul
开机运行 systemctl enable consul