Skip to content

Start modules with a script

Documented releasev0.2.0/Stable main branch

Continue from Your first RPC by putting the two manual startup commands, rpcSubscriber and rpcPublisher, in a script. Vinc will start the modules in order.

Reuse the built open-vinc-examples project from the previous lesson. Run all PowerShell commands below from the repository root, where you can see scripts/ and build/.

The example includes scripts/rpc-startup.tcl:

scripts/rpc-startup.tcl
# Start the receiver before the sender.
rpcSubscriber
rpcPublisher

scripts/rpc-startup.tcl · e165aed

The line beginning with # is a comment. The next two lines are the same ModuleTypes you entered in Vinc Shell.

The central application’s Vinc Shell runs the Tcl script. C++ and Python modules use the same file. The example build already includes the required Tcl runtime.

Commands run in order: wait for rpcSubscriber to start and reach Ready, then start rpcPublisher. Both modules keep running after the script finishes.

If the previous Vinc Shell is still open, enter exit first. Back in PowerShell, run:

Terminal window
.\build\debug\Vinc.exe -S scripts/rpc-startup.tcl

-S selects the script to run at startup. Put Python’s --python option before -S.

The script path is relative to the current working directory, which is why you run this from the repository root. Editing only the .tcl file does not require rebuilding the modules.

You will see startup output from both modules. Wait for:

Script completed: scripts/rpc-startup.tcl

This means the script finished successfully. You can now enter commands in Vinc Shell; both modules have already been created.

Query the received count:

sender count

Wait for the sender to print:

RPC received=0

Send a message:

sender send

Wait for the receiver to print:

received sequence=1 publisher=sender

Enter sender count again to get RPC received=1. The operations are the same as the previous lesson; the script handles module startup.

You can also open Vinc first, then run the same file. Enter exit to close the previous central application. Back in PowerShell, launch without -S:

Terminal window
.\build\debug\Vinc.exe

Once you see VINC ready, enter in Vinc Shell:

srun scripts/rpc-startup.tcl

Again, wait for Script completed: scripts/rpc-startup.tcl. Enter sender count; the newly started receiver replies with RPC received=0.

Use -S to run a script when Vinc starts, or srun to run one from an open Shell.

This example uses fixed instance names, sender and receiver. Running the same startup script again while those modules are running fails because the names are already in use.

exit

Wait for stopped sender, stopped receiver, and a return to PowerShell. Finishing a script leaves the modules running; the Shell’s exit command requests normal shutdown.

No Script completed message?

Check the PowerShell working directory and script path first. If a script command fails, the error reports its file and line, and that script run stops.

Modules that already started keep running. The script does not automatically undo earlier actions. Enter exit to close normally, fix the script, then start again.

Continue with Write logs from your modules to record module activity and choose which levels appear in the Shell.