HELP: Generate CSV of DB in Causal Cluster from external server

Hi there,

I'm looking for how to generate a CSV file in my Neo4j cluster while executing the query from an external server connecting through the cluster's DNS and the Neo4j protocol (which as I currently understand it, routes to the leader automatically).

Currently, for this task, our jobs connect directly to the leader node at that time. The problem is that being in a cluster, the leader role can change after a restart, causing errors in our jobs that connect directly to the leader node.

Now we have an external machine available from which we can connect to the cluster and execute the query that generates the CSV file, but the generated file is stored in /import folder which I don't know previously where node it is in.

I need to know the leader so I can FTP the file to other systems. What I've found so far is this but it's not exactly what I need csv - How to run a cypher script file from Terminal with the cypher-shell neo4j command? - Stack Overflow

In summary: is it possible to get the result of CALL apoc.export.csv.query(Query1, 'file.csv', {delim: '|', quotes: 0}) from the terminal? it only yields the name of the file