Menu-Driven Python Program Reacting To User Input…!

In this article, we have created a menu-driven Python program that will execute the required user tool when the user will give the input as a text.

We can interact with OS through GUI (graphical user interface) and CLI (command-line interface). We can also give instructions to OS through a programming language. In this program, we can instruct to OS using Python. This program gives the idea of how can we make a rule-based ChatBot.

In this program, we will use the os.system() method of OS module. This method executes the command in a subshell.

Syntax: os.system(command)

Return : On Unix, the return value is the exit status of the process and on Windows, the return value is the value returned by the system shell after running command.

Let’s see the Briefing:

Creating a Menu-Driven Program using Python which will react to user input and performs basic operations in RHEL Linux like

  1. HADOOP Configuration
  2. LVM Configuration
  3. AWS Configuration
  4. DOCKER Configuration

Let’s see the implementation:

  1. Hadoop Configuration:

Hadoop provides massive storage for any kind of data, enormous processing power, and the ability to handle virtually limitless concurrent tasks or jobs.

Configuring NameNode and DataNode and then checking for the Report and Status of them and afterward stopping them.

A Configuration setup function for each NameNode and DataNode separately as sub-function and then using them into the main Hadoop-Menu function.

  • NameNode Configuration Function
  • DataNode Configuration Function
  • HadoopMenu Function

2. LVM Configuration:

Logical Volume Management which includes allocating disks, striping, mirroring, and resizing logical volumes. Thus Performing those operations using LVM-Menu.

3. AWS Configuration:

Amazon Web Services a unified tool to manage our AWS services. So we are controlling multiple AWS services, from the command line and automate them through scripts using our AWS-Menu.

4. Docker Configuration:

Docker is an open platform for developing, shipping, and running applications. Thus starting the Docker service and performing some operations using Docker-Menu.

Let’s see the Execution of the Menu Program:

This menu-driven interface will easily help to navigate between the choices of configurations options, with one selection leading to the next menu screen, until the user has completed the desired outcome and exiting the Program.

Source Code: