Running kdb+ as a service on Windows
Windows 7+ provides a task scheduler tool which can be used to run kdb+ processes as services.
To schedule a kdb+ process to start on startup:
Press the +R keys to open Run.
taskschd.mscand press Enter.
Under Actions select Create Task.
Enter a name and description for your task. Select the user under which the task should be run, and if the user should be logged on for the task to run. If you would like the process to be hidden, select the hidden option.
Add a trigger to start the task on system startup:
First click New under the triggers tab.
Select At startup under Begin the task.
Select the actions the task should take before:
Click New under the Actions tab.
q.exewith any command-line arguments and the folder which the process should start in.
Set any required conditions.
Configure any required settings.
When the task is complete, press OK.
If you need to redirect output you must modify the action using the following configuration:
The arguments should be
/c C:\\q\\w64\\q.exe -p 5010 -q >C:\\q\\logs\\q.5010.log
Note the directory for logs must exist.
If you want to set up several instances, the steps required are slightly
different. Rather than configure the task to run
.bat file to start multiple kdb+ processes in the background
and run this from the task.
start "q5010" /B cmd.exe /c C:\\q\\w64\\q.exe -p 5010 -q >C:\\q\\logs\\q.5010.log start "q5011" /B q testScript.q -q
In this way you can set up on Windows a complete kdb+ process that starts all the required processes in the correct order.