Processing Multiple Commands in a Single Filespooler Queue
You'll notice that Filespooler[1]'s `fspl queue-process` command takes a single command. What if you want to permit the sender to select any of several commands to run?
That's actually quite easy, because Filespooler has three ways of passing data from a sending system to the receiver:
1. Command-line parameters
2. Environment variables
3. Piped input
The two easiest ways to select a command are options 1 and 2. The Filespooler Reference[2] lays out how to pass parameters and environment variables; here I will provide an example of parameters.
Example of parameters
Let's say you want a Filespooler service that lets the caller pass data to one of two programs: hd or echo. On the receiver, we may have a script like this:
Save that as proc.sh and mark it executable.
Now on the sender, you could request commands like this:
Now, to process:
And that was exactly the right answer.
Note that this allowed us to pass the parameters to echo but ignore any additional parameters that may have been passed to sha256sum.
--------------------------------------------------------------------------------
Links to this note
- Filespooler[3]
Filespooler lets you request the remote execution of programs, including stdin and environment. It can use tools such as S3, Dropbox, Syncthing[4], NNCP[5], ssh, UUCP[6], USB drives, CDs, etc. as transport; basically, a filesystem is the network for Filespooler.
Filespooler is particularly suited to distributed and Asynchronous Communication[7].
7: /asynchronous-communication/
More on www.complete.org
(c) 2022-2024 John Goerzen