Mate Szalay-Beko created ZOOKEEPER-3646:
-------------------------------------------

             Summary: Executing multiple commands non-interactively with the C 
client cli
                 Key: ZOOKEEPER-3646
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3646
             Project: ZooKeeper
          Issue Type: Improvement
          Components: c client
            Reporter: Mate Szalay-Beko


With the current C CLI client, we can execute a single command, using the 
{{--cmd}} option.
 However, when one wants to execute multiple commands in a session from a bash 
script, he can not really do this now.

The idea is to allow to execute a command file, where ZooKeeper C client CLI 
commands are specified in each line. It would be also great to support to read 
the commands from the standard input, so one is able to use standard unix pipes 
to channel commands to the zookeeper client. This would allow more dynamic 
generation of commands from scripts.

What about the following syntax?
{code:bash}
# execute a single command (this is working now)
cli_mt --host localhost:2181 --cmd 'ls /zookeeper'

# new: execute a list of commands specified in a file
cli_mt --host localhost:2181 --cmd ./zk_commands.txt

# new: read the commands from stdin 
cat ./zk_commands.txt | cli_mt --host localhost:2181 --cmd
{code}
Or if it is easier / nicer, we can add a new parameter and not use {{--cmd}} 
for the last two cases.

Please assign the ticket to yourself if you start working on it (or leave a 
comment).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to