Skip to main content

Shell Script

The Shell Script connector enables you to execute a list of shell commands on a remote server such as AWS, Azure, Droplet, and more by establishing an SSH connection.

Prerequisite

  1. SSH Key Requirement: The Shell Script connector operates using an SSH Key. Therefore, it is essential to have an SSH key associated with your DronaHQ account. If you are unfamiliar with SSH keys and their management, you can learn more about them here.

  2. Server Configuration: The server you intend to connect to must have the public key generated by DronaHQ (known as the SSH Key) saved within its configuration. This step is crucial for enabling successful connections from the DronaHQ environment to the server.

  3. SSH Public Key Storage: To facilitate the connection, the SSH public key generated by DronaHQ must be stored on the remote cloud server. Typically, this involves placing the SSH public key in the authorized SSH key file located at /home/username/.ssh/authorized-keys on the remote server.

Configuring Connector in DronaHQ

Configure your database category using the provided details. Validate connection with Test connection and Save settings for secure database setup.

General

FieldDescription
HostEnter the Host Domain or IP
PortEnter the Port number
Database NameEnter the Database name
UsernameEnter the Username
Shell Script with Sample details.
Shell Script with Sample details.

Admin

Advanced OptionDescription
Connection OptionsThe key and value connection options in database configuration refer to specific settings (keys) and their corresponding values that dictate how the application connects to the database
SSH KeysEnsure you have SSH keys available in your DronaHQ account for secure connections. The server you want to connect to must have the DronaHQ-generated public key/SSH Key saved in it.
Whitelist IP Enhance security by restricting database access to specific whitelisted IP addresses.

Adding Queries to the Connector

Once you have successfully configured the connector, you will find it listed among your Custom Database connectors.

While the server can execute various actions through shell scripts on the backend, utilizing the terminal for these actions can be intricate. To simplify this process and provide a more user-friendly experience, you have the option to leverage a platform that enables smoother action execution.

By clicking the Add query option, which becomes available after your connection is established, you can conveniently define specific actions to perform on the server.

Shell Script with Sample details.
Shell Script with Sample details.

Supported Query Operations

OperationsDescription
Shell CommandExecute custom shell commands directly, facilitating a wide range of server-side operations.
Script ExecutionRun pre-defined shell scripts or shell script files to accomplish specific tasks or workflows.

Using Shell Script Connector

Data Bind using Data Query

Read/Display Data Query for Shell Script Connector:

Begin by crafting a shell script command to extract data using the Shell Script Connector. For example, consider a scenario where you want to retrieve data based on the username "a". The shell script command is:

Shell script command used:

grep "a" /path/to/datafile.txt

Command explanation:

This shell script command uses the grep utility to search for lines containing the username "a" in the specified data file.

Integrate the fetched data into your application's interface.

a. Access the Controls section and introduce the appropriate control for displaying the data.

b. Navigate to Data Bind Options -> Quick Select -> Connector Library..

c. Opt for the Shell Script connector and choose the command that aligns with your data retrieval goals.

By following these steps, you can seamlessly execute the shell script command and retrieve data based on the username "a" using the Shell Script Connector, enhancing your application's functionality and user experience.