From 655c875c03690c638641ce63a34f24d5171c75c2 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Fri, 13 Jan 2017 19:55:16 +0900 Subject: [PATCH] Clean up shutdown logic and logging Add RPC "stop" command, and document it. Fixes the 2nd part of #100 --- HOWTO.rst | 5 +++-- RPC-INTERFACE.rst | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/HOWTO.rst b/HOWTO.rst index eb7f4bd..c7bc41f 100644 --- a/HOWTO.rst +++ b/HOWTO.rst @@ -234,8 +234,9 @@ Terminating ElectrumX ===================== The preferred way to terminate the server process is to send it the -INT or TERM signals. For a daemontools supervised process this is best -done by bringing it down like so:: +**stop** RPC command, or alternatively on Unix the INT or TERM +signals. For a daemontools supervised process this can be done by +bringing it down like so:: svc -d ~/service/electrumx diff --git a/RPC-INTERFACE.rst b/RPC-INTERFACE.rst index 5705134..709c672 100644 --- a/RPC-INTERFACE.rst +++ b/RPC-INTERFACE.rst @@ -2,14 +2,26 @@ The ElectrumX RPC Interface =========================== You can query the status of a running server, and affect its behaviour -using the RPC interface. +by sending JSON RPC commands to the LocalRPC port it is listening on. +This is best done using the electrumx_rpc.py script provided. The general form of invocation is: - ``electrumx_rpc.py [arg1 [arg2...]`` + ``electrumx_rpc.py [-p PORT] [arg1 [arg2...]`` + +The port to send the commands to can be specified on the command line, +otherwise it is taken from the environment variable **RPC_PORT**, or +8000 is used if that is not set. The following commands are available: +* **stop** + + Flush all cached data to disk and shut down the server cleanly, as + if sending the KILL signal. Be patient - during initial sync + flushing all cached data to disk can take several minutes. This + command takes no arguments. + * **getinfo** Returns a summary of server state. This command takes no arguments.