EXEC / SPAWN / KILL
Directive-only. EXEC, SPAWN, and KILL are only valid inside a
DIRECTIVE block. Calling them outside a DIRECTIVE block returns an error. See DIRECTIVE → for full documentation and examples.Why directive-only?
These verbs execute shell commands on a machine. On the Ocalt server that is meaningless — OQL verbs already cover everything the server needs to do. EXEC, SPAWN, and KILL exist so developers can control their own machines via the oql-client agent.
Quick reference
| Verb | Description |
|---|---|
EXEC "command" SET ?out | Run command on target machine, wait for exit. → {stdout, stderr, exit_code} |
EXEC "command" WITH "stdin" SET ?out | Pipe stdin into the command |
SPAWN "command" SET ?pid | Start background process on target machine. → PID number immediately |
KILL ?pid | Send SIGTERM to process by PID on target machine. → true |
Usage — inside DIRECTIVE only
DIRECTIVE "my-server" OPEN NEST
EXEC "systemctl restart nginx" SET ?r
AFTER EMIT ?r(stdout)
CLOSE NEST
DIRECTIVE "my-server" OPEN NEST
SPAWN "python3 /home/worker.py" SET ?pid
AFTER EMIT ?pid
CLOSE NEST
DIRECTIVE "my-server" OPEN NEST
KILL ?pid SET ?ok
AFTER EMIT ?ok
CLOSE NEST