导读
CoreOS服务器有时会系统自动升级,在系统重启后,如何将部署的程序也自动随时系统启动呢?还有Etcd和Flannel。
1、设置Flannel的Unit文件,在Etcd服务启动后启动;把相关配置工作放到Unit文件中,如添加ExecStartPost参数
[Unit]
Description=flannel
After=docker.service
After=etcd2016.service
Requires=docker.service
Requires=etcd2016.service
[Service]
ExecStart=``/var/flannel/flanneld
-etcd-endpoints=http:``//10``.27.155.22:2379
ExecStartPost=-``/var/flannel/startflannel``.sh
ExecStartPost=-``/usr/bin/docker
start dn-weixin dn-``users
dn-task dn-signin dn-daodao
[Install]
WantedBy=multi-user.target
2、使用Systemd将自定义的Etcd2和Flannel设置为自动启动
systemctl
enable
etcd2016.service
systemctl
enable
flannel2016.service
systemctl daemon-reload