core-lightning/doc/lightning-plugin.7.md
Brian Barto 24b02c33cc
lightning-cli plugin start - Assume default relative path
When starting a plugin, if the plugin path cannot be found in
absolute context, assume it is a relative path to the default
plugins dir. As a result, the following now works when my_plugin.py
is installed in the default plugins dir:

lightning-cli plugin start my_plugin.py

Also update the plugin documentation to reflect that the use of a
relative path is now available.

Changelog-Added: plugin start RPC subcommand now assumes relative path to default plugins dir if the path is not found in absolute context. i.e. lightning-cli plugin start my_plugin.py

[ Squashed two commits into one -- RR ]
2022-06-17 14:18:48 +09:30

2.3 KiB

lightning-plugin -- Manage plugins with RPC

SYNOPSIS

plugin command [parameter] [second_parameter]

DESCRIPTION

The plugin RPC command allows to manage plugins without having to restart lightningd. It takes 1 to 3 parameters: a command (start/stop/startdir/rescan/list) which describes the action to take and optionally one or two parameters which describes the plugin on which the action has to be taken.

The start command takes a path as the first parameter and will load the plugin available from this path. The path can be a full path to a plugin or a relative path to a plugin that is located in or below the default plugins directory. Any additional parameters are passed to the plugin. It will wait for the plugin to complete the handshake with lightningd for 20 seconds at the most.

The stop command takes a plugin name as parameter. It will kill and unload the specified plugin.

The startdir command takes a directory path as first parameter and will load all plugins this directory contains. It will wait for each plugin to complete the handshake with lightningd for 20 seconds at the most.

The rescan command starts all not-already-loaded plugins from the default plugins directory (by default ~/.lightning/plugins).

The list command will return all the active plugins.

RETURN VALUE

On success, an object is returned, containing:

  • command (string): the subcommand this is responding to (one of "start", "stop", "rescan", "startdir", "list")

If command is "start", "startdir", "rescan" or "list":

  • plugins (array of objects):
    • name (string): full pathname of the plugin
    • active (boolean): status; since plugins are configured asynchronously, a freshly started plugin may not appear immediately.

If command is "stop":

  • result (string): A message saying it successfully stopped

On error, the reason why the action could not be taken upon the plugin is returned.

AUTHOR

Antoine Poinsot <darosior@protonmail.com> is mainly responsible.

RESOURCES

Main web site: https://github.com/ElementsProject/lightning