Back to ITRS Internal Only FAQ

Internal documentation only

This page has been marked as draft.

How to create a command script with user input

Commands:

Gateway commands are the primary method of interaction between the Gateway and connected users. Users invoke commands through a controlling process (such as Active Console), prompting the Gateway to perform a given operation.

Creating the bash script.

The first step is to create a bash script accessible via the active console command.

In this example, we’ll develop a file locator capable of searching for a specific file or employing wildcard values to locate multiple files.

Bash Script:

Geneos - How to create a command script with user input

Bash Script:

#!/bin/bash

file_location=$1

file_pattern=$2

days=$3

if [ ! -d "$file_location" ]; then

echo "Error: The file location '$file_location' does not exist"

exit 1

fi

After creating this script, proceed to set up the command in the GSE.

Note: The file locator script has been named Diskcleanup_test.sh

Creating the Command:

Geneos - How to create a command script with user input

Command:

script gateway /opt/netprobe/toolkit\_scripts/Diskcleanup\_test.sh /opt/netprobe/toolkit\_scripts/ \*.sh 5

Once created, test the command by right-clicking on a managed entity icon in the Active Console.

Geneos - How to create a command script with user input

Upon right-clicking, a prompt will appear on your screen, allowing you to fill in the required fields.

Geneos - How to create a command script with user input

Output:

Geneos - How to create a command script with user input

This feature proves helpful when you need to locate a file without direct access to the backend server. It also speeds up the identification of missing files crucial for your active console, such as FKM logs.

["Geneos"] ["FAQ"]

Was this topic helpful?