Skip to content

Instantly share code, notes, and snippets.

@preetapan
Last active June 22, 2017 22:13
Show Gist options
  • Save preetapan/70b918e03be2b82a2b1f0e732f039b1e to your computer and use it in GitHub Desktop.
Save preetapan/70b918e03be2b82a2b1f0e732f039b1e to your computer and use it in GitHub Desktop.
testing consul watches
//agent config file with watch handler
{
"advertise_addr": "127.0.0.1",
"bind_addr": "127.0.0.1",
"data_dir":"/tmp/consultest",
"datacenter":"mydc",
"ui":true,
"server":true,
"watches":[
{
"type": "key",
"key": "test",
"handler": "/home/preetha/watch_handler.sh"
}
]
}
//contents of watch handler script (it echoes the input, nothing fancy)
#! /bin/bash
[ $# -ge 1 -a -f "$1" ] && input="$1" || input="-"
cat $input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment