Skip to content

implement listen options to dump requests or run arbitrary commands

Philipp S. Sommer requested to merge listen-options into master

this MR implements various options for the listen command to customize the processing. namely the following three options are implemented (also described in #54 (closed))

  --dump-to LISTEN_CONFIG.DUMP_TO
                        Instead of processing the request, dump it as a file to the given location. If you need further customization, use ``--dump-tool``.
  --dump-tool LISTEN_CONFIG.DUMP_TOOL
                        Instead of using ``--dump-to``, use this option to run a specific command for each request. We will first create a temporary file and then run this command as subprocess. This parameter requires `--dump-to` and two curly brackets (``{}``) in the
                        argument that specify where to insert the target path. Or use ``{path}`` or ``{basename}`` or ``{directory}`` for more explicit control in your command. If you want to process the dumped file further, combine this option with ``--cmd`` **Examples** Copy
                        the request to a given location via rsync:: --dump-tool 'rsync {} .' Copy the request via SSH to another server:: --dump-tool 'scp {} user@machine:/some/folder/' Print the request to stdout and delete the temporary file:: --dump-tool 'cat {path} && rm
                        {path}'
  -c LISTEN_CONFIG.CMD, --cmd LISTEN_CONFIG.CMD
                        Instead of processing the request here, dump the request as file to the disc and run the dedicated command. The specified command must contain two curly braces (``{}``) that will be replaced with the path or basename of th file. Or use ``{path}``, or
                        ``{basename}`` or ``{directory}`` for more explicit control in your command. **Examples** Cat the request (i.e. always return the input to the sender):: --cmd 'cat {}' Copy the file via scp and run some command to process it on a remote machine::
                        --dump-tool 'scp {} user@machine:/some/folder/' --cmd 'some-command /some/folder/{basename}'

closes #54 (closed)

Merge request reports

Loading