版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhang197093/article/details/78729541
etcdctl exec-watch 命令可以检测某个key的值的改变,并执行相应的命令,帮助文档显示的用法:
[root@localhost ~]# etcdctl exec-watch --help
USAGE:
etcdctl exec-watch [command options] <key> <command> [args...]
但实际上应该是:
etcdctl exec-watch [command options] <key> -- <command> [args...]
也就是 <command> 之前需要添加两个 -
例如:
[root@localhost ~]# etcdctl exec-watch /hello -- /bin/echo 'hello etcd'
hello etcd
hello etcd