keepalived在centos7下的服务脚本
新增文件/usr/lib/systemd/system/keepalived.service,内容如下:
[Unit]
Description=Keepalived
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/var/run/keepalived.pid
ExecStart=/data/keepalived/sbin/keepalived -D -f /data/keepalived/etc/keepalived/keepalived.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
重载使脚本生效/自启
systemctl daemon-reload
systemctl enable keepalived.service