Search code examples
powershellkdb

Executing multiple q process


I have a question regarding executing multiple q processes in Windows Powershell via single PowerShell script.

When I previously had an access to kdb+/q in Linux box, I created a bash script that can start multiple q processes with 'nohup' function.

e.g. https://groups.google.com/forum/#!msg/personal-kdbplus/3pDLV-Waahc/b0f9oh68AgAJ

Given that I can now only access kdb+/q in Windows Powershell, I wanted to see if there is an easy/simple way of achieving same results as running bash script in Linux environment which contains multiple nohup q script such that I can execute and run a group of q scripts in one-go, in the background.

Is there any pointer/script that achieves the same purpose?


Solution

  • There is a simple way of using Windows Powershell that achieves the same results as running a bash script in a Linux environment.

    Start-Process will start a process and keep executing the Powershell script.

    A colleague of mine wrote this script, for example:

    https://github.com/jonathonmcmurray/TorQ-Coinbase/blob/master/start_coinbase.ps1

    The most relevant line is line 66:

    Start-Process "q.exe" $path -RedirectStandardOutput logs/torq$procname.txt
    

    Is what starts the process where:

    • $path is the path to the script to load and parameters
    • -RedirectStandardOutput is equivalent to > in linux, allowing logging to a file rather than to console