COMMAND (for auto logout)

This is an element of AUTO_LOGOUT that provides a mechanism for the Genero Application Server to override an application's auto logout.

Syntax

<COMMAND Timeout=seconds>command-script</COMMAND>
  1. The Timeout attribute specifies a timeout value. In the seconds parameter you specify a number of seconds as the time allowed for the command process to complete. If the system does not respond within this time, the GAS terminates the command process.
  2. command-script is the name of the script or command to be run. You specify in this a check for conditions that would override the auto logout. An exit code value of zero is returned, if the auto logout is to be overridden, otherwise a non-zero value is returned.

Child elements

There are no child elements.

Usage

Use the COMMAND option to override the auto logout process. For example, the command can be used to override auto logout during work hours.

Example: shell script for UNIX® like systems

In the sample script, an exit command is called to execute the autologout. The command can be used to override the auto logout process. If you don't want the auto logout to occur, replace exit 1 with exit 0.
#!/usr/bin/env bash
exit 1
In the sample application configuration file, the auto-logout is set:
  • The COMMAND element is set to the script path. It is recommended to set an absolute path, as the path from where the application is started may be different. If a directory or filename contain spaces, you must surround the path with double quotes. Also ensure the GAS user has permission to execute the script.
  • The Timeout attribute of the command is set to 20 seconds as the time allowed for the command process to complete.
<APPLICATION>
  <EXECUTION>
    <PATH>/usr/local/genero/apps</PATH>
    <MODULE>myapp.42r</MODULE>
  </EXECUTION>
  <AUTO_LOGOUT>
    <TIMEOUT>30</TIMEOUT>
    <COMMAND Timeout="20">/fjs/gas/deploygas/appdata/app/cmd.sh</COMMAND>
  </AUTO_LOGOUT>
</APPLICATION>

Example: bat file for Windows®

In the sample batch file, an exit command is called to execute the autologout. The command can be used to override the auto logout process. If you do not want the auto logout to occur, replace exit /B 0 with exit /B 1.
exit /B 0
In the sample application configuration file, the auto-logout is set:
  • The COMMAND element is set to the script path. It is recommended to set an absolute path, as the path from where the application is started may be different. If a directory or filename contain spaces, you must surround the path with double quotes. Also ensure the GAS user has permission to execute the script.
  • The Timeout attribute of the command is set to 20 seconds as the time allowed for the command process to complete.
<APPLICATION>
  <EXECUTION>
    <PATH>/usr/local/genero/apps</PATH>
    <MODULE>myapp.42r</MODULE>
  </EXECUTION>
  <AUTO_LOGOUT>
    <TIMEOUT>30</TIMEOUT>
    <COMMAND Timeout="20">C:\ProgramData\FourJs\gas\gasVersion\app\mycmd.bat</COMMAND>
  </AUTO_LOGOUT>
</APPLICATION>

Example: Genero BDL program

In this sample, a Genero program is called to execute the autologout. The command can be used to override the auto logout process. If you don't want the auto logout to occur, replace EXIT PROGRAM 1 with EXIT PROGRAM 0.
MAIN
EXIT PROGRAM 1
END MAIN 
In the sample application configuration file, the auto-logout is set:
  • The COMMAND element is set to the program path. It is recommended to set an absolute path, as the path from where the application is started may be different. Also ensure the GAS user has permission to execute the program.
  • The Timeout attribute of the command is set to 20 seconds as the time allowed for the command process to complete.
<APPLICATION>
  <EXECUTION>
    <PATH>/usr/local/genero/apps</PATH>
    <MODULE>myapp.42r</MODULE>
  </EXECUTION>
  <AUTO_LOGOUT>
    <TIMEOUT>30</TIMEOUT>
    <COMMAND Timeout="20">fglrun /fjs/gas/deploygas/appdata/app/prog.42m</COMMAND>
  </AUTO_LOGOUT>
</APPLICATION>

Refer to Table 1 as a guide to how the command and the timeout may affect the auto logout under different conditions.

Table 1. How the command affects auto logout
Scenario Exit code Result
The script runs. Condition to override auto logout is valid. 0 The auto logout does not occur. The application keeps running.
The script runs. Condition to override auto logout is not valid. A non-zero exit code is returned The auto logout occurs as usual and stops the application.
The script may or may not run. The GAS times out the command process. A non-zero exit code is returned The auto logout occurs as usual and stops the application.

Parent elements

This element is a child of the following: