Skip to content

Instantly share code, notes, and snippets.

@foostan
Last active August 29, 2015 14:06
Show Gist options
  • Save foostan/2edcb24de16dbdadf51a to your computer and use it in GitHub Desktop.
Save foostan/2edcb24de16dbdadf51a to your computer and use it in GitHub Desktop.
exit code of fileconsul
root@server:/consul/share# fileconsul status --addr 'localhost:8501'
2014/09/22 06:33:22 Get http://localhost:8501/v1/kv/fileconsul?dc=dc1&recurse=: dial tcp 127.0.0.1:8501: connection refused
root@server:/consul/share# echo $?
1
root@server:/consul/share# fileconsul status --dc 'dc2'
2014/09/22 06:33:52 [WARN] consul.rpc: RPC request for DC 'dc2', no path found
2014/09/22 06:33:52 [ERR] http: Request /v1/kv/fileconsul?dc=dc2&recurse=, error: No path to datacenter
2014/09/22 06:33:52 Unexpected response code: 500
root@server:/consul/share# echo $?
1
root@server:/consul/share# fileconsul status
Changes to be pushed:
(use "fileconsul push [command options]" to synchronize local files)
add remote file: bin/ntp
add remote file: bin/apache2
add remote file: bin/loadavg
add remote file: config/service/apache2.json
add remote file: config/service/ntp.json
add remote file: config/template/server/check_loadavg.json
add remote file: config/template/server/service_apache2.json
add remote file: config/template/server/agent_server.json
#!/bin/bash
add remote file: config/template/server/service_ntp.json
add remote file: config/template/client/check_loadavg.json
add remote file: config/template/client/agent_client.json
add remote file: config/template/client/service_ntp.json
add remote file: config/check/loadavg.json
root@server:/consul/share# echo $?
0
root@server:/consul/share# fileconsul push
add remote file: bin/ntp
add remote file: bin/apache2
add remote file: bin/loadavg
add remote file: config/service/apache2.json
add remote file: config/service/ntp.json
add remote file: config/template/server/check_loadavg.json
add remote file: config/template/server/service_apache2.json
add remote file: config/template/server/agent_server.json
add remote file: config/template/server/service_ntp.json
add remote file: config/template/client/check_loadavg.json
add remote file: config/template/client/agent_client.json
add remote file: config/template/client/service_ntp.json
add remote file: config/check/loadavg.json
root@server:/consul/share# echo $?
0
root@server:/consul/share# vi bin/apache2
root@server:/consul/share# fileconsul status
Changes to be pushed:
(use "fileconsul push [command options]" to synchronize local files)
modify remote file: bin/apache2
Changes to be pulled:
(use "fileconsul pull [command options]" to synchronize remote files)
modify local file: bin/apache2
root@server:/consul/share# echo $?
0
root@server:/consul/share# fileconsul push
modify remote file: bin/apache2
root@server:/consul/share# echo $?
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment