aboutsummaryrefslogtreecommitdiffstats
path: root/docs/config.md
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-10-26 18:03:00 -0500
committerJP Dillingham <jp@dillingham.me>2024-10-26 18:03:00 -0500
commitb2c01f2bfb1b7ae910ee52554a973cad3a71171a (patch)
treeedd6581907baa452b2b6b2572860a822da342866 /docs/config.md
parentf276acf7a74e84dd843bafc7be776fb413ccdb94 (diff)
downloadslskd-b2c01f2bfb1b7ae910ee52554a973cad3a71171a.tar.gz
add basic docs for scripts
Diffstat (limited to 'docs/config.md')
-rw-r--r--docs/config.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/config.md b/docs/config.md
index ce1fe2b1..74c29b49 100644
--- a/docs/config.md
+++ b/docs/config.md
@@ -919,6 +919,29 @@ retention:
# Integrations
+## User-Defined Scripts
+
+User-defined scripts can be configured to run when application events are raised. Scripts are given a name (useful for troubleshooting!), a list of triggering events, and a `run` command that's used to execute the script.
+
+The `run` command must be at least two words, with the first word identifying the executable to run and the rest of the string being the command and arguments that will be passed to the executable when the script is run. The executable needs to be on the system's PATH, otherwise it must be the fully qualified path to the file on disk.
+
+A reserved placeholder value `$DATA` is replaced with the stringified JSON data associated with the event that caused the script to run. It's the responsibility of the script to parse and handle this JSON.
+
+#### **YAML**
+```yaml
+integration:
+ scripts:
+ my_post_download_script:
+ on:
+ - DownloadFileComplete
+ - DownloadDirectoryComplete
+ run: /bin/sh data/my_script.sh --json-to-process "$DATA" # Linux/macOS
+ my_logging_script:
+ on:
+ - All
+ run: cmd.exe echo $DATA >> event_log.txt # Windows
+```
+
## FTP
Files can be uploaded to a remote FTP server upon completion. Files are uploaded to the server and remote path specified using the directory and filename with which they were downloaded; the FTP will match the layout of the local disk.