Session management commands

get connections

This command returns the list of connections to the current runtime instance, including local connections.

get connections
Example 1. Example with local connections
localhost:42200 > get connections
User  Client Host Start Date                   Last Access                  Id
      127.0.0.1   Fri Feb 02 11:25:40 CET 2024 Fri Feb 02 11:25:00 CET 2024
admin 127.0.0.1   Fri Feb 02 11:00:00 CET 2024 Fri Feb 02 11:00:00 CET 2024 460887c2-c633-4a54-b603-bb2fae3c6f20
admin 127.0.0.1   Fri Feb 02 11:00:00 CET 2024 Fri Feb 02 11:00:00 CET 2024 79a46934-1a30-40fe-b1aa-2b1ab56dd019
admin 127.0.0.1   Fri Feb 02 11:00:00 CET 2024 Fri Feb 02 11:25:00 CET 2024 17c1c546-b38c-445f-bce9-aa213dc3e599

get sessions

This command returns the list of sessions for the current runtime instance. The list includes sessions both from the runtime log database; as well as sessions actively running in-memory.

get sessions [name <name>]
    [id <id1,id2,idn>]
    [status <running,error,done,stopped>]
    [duration <min>]
    [to <max>]
    [limit <limit>]
    [format <format>]
Option Mandatory Description

name <name>

No

Session Name.

id <id1,id2,idn>

No

Comma-separated list of session IDs.

status <status>

No

Filter sessions with this status: running, error, done, stopped.

duration <min>

No

Filter sessions with this minimum duration in milliseconds.

to <max>

No

Filter sessions with this maximum duration in milliseconds.

limit <limit>

No

Number of sessions to retrieve.

format <format>

No

Defines the comma-separated list of columns to return in the output.

The available columns are %name, %status, %begindate, %enddate, %configuration, %id, %deliveryid, %runtimehost, %runtimeport, %executionmode, %guesthost, %errormessage, %exception, and %parentiter.

markInactiveSessionsAsDead

This command reviews the content of the sessions log database, and marks inactive sessions as dead.

Inactive sessions ar sessions with an inconsistent state. They can occur if the runtime stops abruptly while sessions are still active. You can purge these sessions using the purge keep or schedule purge keep commands, specifying the dead status.

markInactiveSessionsAsDead

purge keep

This command purges the session logs.

You can also do this command on a schedule using the schedule purge keep command.

purge keep <number> <minute|hour|day|session>
    [sessionid <id1,id2,...>]
    [sessionname <name,name2,...>]
    [status <done,error,killed,dead>]
Option Mandatory Description

keep <number> <minute|hour|day|session>

Yes

Number of sessions, and length of session history, to keep in the log.

sessionid <id>

No

Comma-separated list of session IDs to purge.

sessionname <name>

No

Comma-separated list of session names to purge.

status <done,error,killed,dead>

No

Comma-separated list of statuses that are okay to purge.

Example 2. Keep only the last 100 sessions
purge keep 100 session
Example 3. Purge the session which ID is mySessionid
purge keep 0 session sessionid mySessionid
Example 4. Purge sessions named 'mySession' with the status 'done', keeping only the last 5
purge keep 5 session sessionname mySession status done
Example 5. Keep sessions for the last 3 days:
purge keep 3 day

restart session

This command restarts a given session.

restart session <id> [synch] [format <format>]
Option Mandatory Description

id

Yes

ID of the session to restart.

synch

No

Waits for the session to restart, then continues. By default, the command does not wait until the session restarts to proceed.

format

No

Defines the comma-separated list of columns to return in the output. This option only works in synch mode.

The following columns are available: '%name`, %status, %begindate, %enddate, %configuration, %id, %executionmode, %guesthost, %iter, %launchmode, %runtimehost, %runtimeport, %returncode, %errormessage, %exception, and %parentiter.

Example 6. Restart a session
restart session c0a84b0b016716c58c17de7b2e8a75c9

Session: c0a84b0b016716c58c17de7b2e8a75c9 is restarted
Example 7. Restart a session with a formatted output
restart session c0a84b0b016716c58c17de7b2e8a75c9 synch format %id,%status,%returncode

Session: c0a84b0b016716cadadf88fc29a8c399 is restarted...
c0a84b0b016716cadadf88fc29a8c399,ERROR,-1

schedule purge keep

This command schedules a purge of the session logs.

schedule purge keep <number> <minute|hour|day|session>
    cron <cron_expression>
    [sessionname <name,name2,...>]
    [sessionid <id1,id2,...>]
    [status <done,error,killed,dead>]
    [on host <host_name>]
    [port <host_port>]
Option Mandatory Description

keep <number> <minute|hour|day|session>

Yes

Number of sessions, and length of session history, to keep in the log.

cron <cron_expression>

Yes

Cron expression to run the schedule.

sessionid <id>

No

Comma-separated list of session IDs to purge.

sessionname <name>

No

Comma-separated list of session names to purge.

status <done,error,killed,dead>

No

Comma-separated list of statuses that are okay to purge.

on host <host_name>

No

Hostname or address of the runtime host. If this option is not set, uses the connected runtime.

port <host_port>

No

Runtime port.

Example 8. Schedule a purge, keeping the 10 last sessions
schedule purge keep 10 session cron "0 15 10 * * ? *"

stop session

This command sends a stop signal to a running session.

stop session <id> [synch] [format <format>]
Option Mandatory Description

id

Yes

ID of the session to stop.

synch

No

Waits for the session to stop before going back to the command line.

format

No

Defines the comma-separated list of columns to return in the output. This option only works in synch mode.

The following columns are available: %name, %status, %begindate, %enddate, %configuration, %id, %executionmode, %guesthost, %iter, %launchmode, %runtimehost, %runtimeport,%returncode, %errormessage, %exception, %parentiter

Example 9. Stop a session
stop session c0a84b0b016716c58c17de7b2e8a75c9

Sending a stop request to session c0a84b0b016716c58c17de7b2e8a75c9...
Stop request has been successfully sent to session c0a84b0b016716c58c17de7b2e8a75c9
Example 10. Stop a session with a formatted output
stop session c0a84b0b016716c6b50bd39807324430 synch format %id,%status,%returncode

Sending a stop request to session c0a84b0b016716c6b50bd39807324430...
Session: c0a84b0b016716c6b50bd39807324430 is stopping...
c0a84b0b016716c6b50bd39807324430,STOPPED,-2

wait session

This command waits for a session to complete, and issue the session return code as the output.

wait session <id> [format <format>]
Option Mandatory Description

id

Yes

Id of the session to wait for.

format

No

Defines the comma-separated list of status information to return in the output when the session ends.

The following columns are available: %name, %status, %begindate, %enddate, %configuration, %id, %executionmode, %guesthost, %iter, %launchmode, %runtimehost, %runtimeport, %returncode, %errormessage, %exception, and %parentiter.

Example 11. Wait for a session
wait session c0a84b0b016716cdb01b379e2eddf9a3

1
Example 12. Wait for a session with a formatted output
wait session c0a84b0b016716c58c17de7b2e8a75c9 format %id,%status,%returncode

c0a84b0b016716c58c17de7b2e8a75c9,EXECUTED,1