Xentara v2.1
User Manual
Operational Stages

Xentara has a number of different operational stages that it traverses during its run time. Xentara has the following stages:

Startup Stage

In this stage, Xentara performs one-time initialization when it is started.

Pre-Operational Stage

In this stage, Xentara prepares all systems before entering the operational stage.

Operational Stage

In this stage, Xentara performs its normal operational tasks. This is the stage that Xentara is in during normal operation.

Post-Operational Stage

In this stage, Xentara cleans up all systems after leaving the operational stage.

Shutdown Stage
In this stage, Xentara performs one-time cleanup before it is terminated.

Normal operation of Xentara can be suspended without stopping Xentara completely. If Xentara is suspended, an additional stage is entered:

Suspended Stage
In this stage, Xentara is idle and performs only minimum necessary maintenace tasks.

Sequence of Stages

When Xentara is started, the Startup stage is executed, followed by the pre-operational stage. After the pre-operational stage has completed, Xentara will go into the operational stage. The operational stage is then executed until Xentara is stopped. Once Xentara is stopped, the post-operational stage is executed, followed by the shutdown stage. After the shutdown stage has completed, the Xentara application will exit.

Here is the sequence of stages when Xentara is started and stopped:

Xentara can be suspended during operation without completely shutting it down. When Xentara receives a suspend request, the post-operational stage is executed, after which Xentara goes into the suspended stage. Xentara remains in the suspended stage until a resume command is received. When a resume command is received, the pre-operational stage is executed. After the pre-operational stage has completed, Xentara will go back into the operational stage.

Here is the sequence of stages when Xentara is suspended and resumed:

The Individual Stages

The exact actions performed during each stage are determined by the individual skills. This chapter only describes the general type of action performed in the different stages.

The Startup Stage

In the startup stage, skills perform one-time intialization that doesn't need to be redone after a suspend and resume. This is usually limited to initializing local hardware, like network interfaces or serial ports.

The Pre-Operational Stage

In the pre-operational stage, skills perform initialization that is necessary for proper operation of Xentara. Specifically, skills will open connections to remote devices and read the values of all the inputs.

After the pre-operational stage has finished, all data points will contain valid values, as long as the underlying data source (e.g. the physical hardware they are read from) is functioning correctly. Only data points whose underlying data source is offline or otherwise cannot provide data, will contain errors.

The Operational Stage

In the operational stage, skills perform their main function. Specifically, I/O component are serviced normally, and skill elements perform their operations normally. The operational stage is maintained until Xentara is shut down or operation is suspended.

The Post-Operational Stage

In the pre-operational stage, skills and skills perform cleanup for the actions taken in the operational stage. Specifically, skills will close all connections to remote devices and invalidate the values of the inputs.

The Shutdown Stage

In the shutdown stage, skills and skills perform perform cleanup for the actions taken in the startup stage.

The Suspended Stage

In the suspended stage, skills and skills only perfrom minimal maintenance tasks. Timers and events are no longer processed, and no data is generally available.

Suspending and Resuming Xentara

Suspending and Resuming Xentara Using the Xentara Debugger

You can use the Xentara Debugger to suspend and resume Xentara. Start the debugger to connect to Xentara, and type “suspend” or “resume” at the debugger prompt.

Suspending and Resuming Xentara Using Signals (Linux only)

Under Linux, Xentara can be suspended by sending it the signal USR1. To resume Xentara when it is suspended, send USR2.

Sending Signals to a systemd Service

If Xentara is running as a systemd service as described in systemd Service, you can use systemctl to send signals to Xentara. To suspend a Xentara service running under the user name username, use the following command:

sudo systemctl kill -s USR1 xentara@username

To resume the same Xentara instance, use the following command:

sudo systemctl kill -s USR2 xentara@username
Attention
Don’t forget to replace username with the correct user name.
Note
The user executing these commands will need special privileges to be able to use sudo(8). This is usually accomplished by adding the user to the sudo user group. This can only be done by the root user, or by another user that already has sudo access.
man pages
systemctl(1)

Sending Signals to a Manually Started Process

If you have started Xentara manually, or if you used a different mechanism than systemd to start Xentara, you must use a different method of sending the USR1 and USR2 signals. If you know the PID of the Xentara instance you want to suspend or resume, you can use the kill command to send the signals. To suspend the Xentara instance with PID 2488, use the following command:

kill -USR1 2488

To resume the Xentara instance with PID 2488, use the following command:

kill -USR2 2488
Attention
Don’t forget to replace 2488 with the correct PID.

If you do not know the PID of the Xentara instance you wish to suspend or resume, you can use the pgrep command to list the PIDs of all running Xentara instances:

pgrep -xa xentara

The option -x (or --exact) tells pgrep to only list processes with the exact name xentara. Without this option, pkill will list any process whose name contains the string “xentara”, including xentara-debugger and xentara-licence-proxy. The option -a (or --list-full) tells pgrep to output the full command line of each xentara instance next to the PID.

You can also use the pkill command to send the signal to all running Xentara instances:

pkill -USR1 -x xentara

To resume all running Xentara instances, use the following command:

pkill -USR2 -x xentara

The option -x (or --exact) tells pkill to only send the signal to processes with the exact name xentara. Without this option, pkill will send the signal to any process whose name contains the string “xentara”, including xentara-debugger and xentara-licence-proxy.

man pages
kill(1), pgrep(1) pkill(1)

Suspending and Resuming Xentara Running as a Windows Service

If Xentara is running as a Windows service as described in Windows Service, you can suspend and resume Xentara by pausing and resuming the Windows service. Windows services can be paused and resumed using PowerShell, or by using the “Services” MMC snap-in. You can open the “Services” snap-in by typing “Services” in the Windows Task bar search field, or you can open the snap-in from the Computer Management console.

Pausing and Resuming the Service Using the “Services” Snap-In

Note
Windows users require special privileges to pause and resume services.

Open the “Services” snap-in, and scroll down until you find Xentara service:

Image 1: the “Pause” option in the “Services” MMC snap-in

Click on the “Pause” option to suspend Xentara. To resume operation, click on the the “Resume” option, which will appear as soon as Xentara is suspended:

Image 1: the “Resume” option in the “Services” MMC snap-in

You can also right-click on the Xentara service, or double-click on it and use the Properties window.

Pausing and Resuming the Service Using PowerShell

Note
To manage Windows services, PowerShell needs to be run as an administrator. To run PowerShell as an administrator, right-click on the PowerShell or Terminal icon in the Windows Start Menu, and select “Run as Administrator”.

To pause the Xentara service, use the following command:

Suspend-Service Xentara

Note that the PowerShell command is called “Suspend-Service”, and not “Pause-Service”.

To resume the Xentara service, use the following command:

Resume-Service Xentara
PowerShell commands
Suspend-Service, Resume-Service

Suspending and Resuming Xentara From Remote Clients

Some Xentara remote client interfaces, like the Xentara WebSocket interface allow privileged clients to suspend and resume Xentara. The remote client must have the “suspend” entitlement in order to suspend and resume Xentara.

Fot the Xentara Websocket interface, please refer to the Xentara WebSocket API Specification on information on hopw to suspend and resume Xentara using the WebSocket API. For remote client connection provided by skills, please refer to the documentation fo the corresponding skill on whether and how clients can suspend and resume Xentara.