Configured watches not working

I have setup a key watch, see config below. It does not seem to be firing.
Interestingly, if I setup the same watch from the cli it works perfectly.
/consul/config/watches.json
{
“watches”: [
{
“type”: “key”,
“key”: “configs/webcoma/dev”,
“handler_type”: “script”,
“args”: [“sh”, “-c”, “/usr/bin/log-coma-dev.sh”, “dev”]
},
{
“type”: “key”,
“key”: “configs/webcoma/qa”,
“handler_type”: “script”,
“args”: ["/usr/bin/log-coma-dev.sh", “qa”]
}
]
}

this command works:
consul watch -type=key -key=configs/webcoma/dev /usr/bin/log-coma-dev.sh

1 Like

Hey Karl,

Welcome to the Consul Community!

Can you provide the error messages you’re seeing when trying to run that json file?

There is no error, the script just is not running from what I can tell.
When I use the cli command it works, when I run it from the server it works. When I use the above watches json it does not. When I reload the config, I get no errors and the log.txt file is created. But when I update the value, the script does not run.
Here is my script:

#!/bin/sh

echo “This is running” >> ~/logs/log.txt
echo “This is running”

1 Like