Hi Obie, On Thursday, 25 August 2016 23:03:42 UTC+2, Obie wrote: > > I tried this script: > > > #!/bin/bash > > for shard in $(curl -XGET http://localhost:9200/_cat/shards | grep > UNASSIGNED | awk '{print $2}'); do > curl -XPOST 'localhost:9200/_cluster/reroute' -d '{ > "commands" : [ { > "allocate" : { > "index" : "graylog_0", > "shard" : $shard, > "node" : "Atum", > "allow_primary" : true > } > } > ] > }' > sleep 5 > > done > > > And get this error: > > > ubuntu@graylog:~$ ./shards_allocate.sh > % Total % Received % Xferd Average Speed Time Time Time > Current > Dload Upload Total Spent Left > Speed > 100 1440 100 1440 0 0 260 0 0:00:05 0:00:05 --:--:-- > 358 > {"error":{"root_cause":[{"type":"json_parse_exception","reason":"Unrecognized > token '$shard': was expecting ('true', 'false' or 'null')\n at [Source: > org.elasticsearch.transport.netty.ChannelBufferStreamInput@8227be3; line: > 5, column: 28]"}],"type":"json_parse_exception","reason":"Unrecognized > token '$shard': was expecting ('true', 'false' or 'null')\n at [Source: > org.elasticsearch.transport.netty.ChannelBufferStreamInput@8227be3; line: > 5, column: 28]"},"status":500}^C > ubuntu@graylog:~$ > > > What am I missing? >
Single quotes don't allow string interpolation. You have to use double quotes and escape the double quotes inside the string accordingly: http://wiki.bash-hackers.org/syntax/quoting Cheers, Jochen -- You received this message because you are subscribed to the Google Groups "Graylog Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/graylog2/09c6e194-7792-4685-89c2-a516a411598f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
