Search code examples
kdb

Auto shut down for KDB instance


I am trying to set an auto shutdown on a KDB instance 24 hours after the launch.

I have been playing around with the .z.exit and \t but could not figure it out.


Solution

  • You need to set the timer function .z.ts (https://code.kx.com/q/ref/dotz/#zts-timer) which is triggered at each interval set by \t to terminate the q process using exit (https://code.kx.com/q/ref/exit/), e.g.

    q) set timer to 24 hours (milliseconds)
    q)\t 24*60*60*1000
    q).z.ts:{exit 0}