M
M
MarkBogrov2020-12-28 18:39:35
Nginx
MarkBogrov, 2020-12-28 18:39:35

VPS: How to connect the web interface to the command line?

Please tell me in which direction I need to read, I want to use the web interface with a bunch of ubuntu server command line. The question is that I have no idea how to access the command line from the web and return the result of the CLI back to the user's browser.

To understand the issue, I will write a few examples of what I would like to learn:
Examples of use:

  1. An API that receives a request with parameters via https and, for example, creates / copies folders, respectively, this is mkdir / cp on the command line, the question is how to execute something from the web and return a response to the user that everything went ok or if not ok - the error text from the CLI
  2. Uploading files, processing, for example, through nconvert or ffmpeg, and sending the user a link to the file or the file itself to download
  3. Pull some utilities like certbot, etc., and again give the result of the console utility to the client in the browser


I am not looking for an answer to these three cases in particular, it would be interesting to learn how to work in conjunction: requests from the web + processing at the operating system (command line) level and issuing the result back to the web. Tell me what technologies you should pay attention to and what keywords to google, you can in English. My problem is that I don't know what to ask Google.

Thank you for your attention to my problem =)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sanes, 2020-12-28
@MarkBogrov

Depends on the programming language. In PHP, this is the passthru function . There are analogues in other languages.

T
Talyan, 2020-12-28
@flapflapjack

By the way, I’ll join the TS question, but I’m wondering if there is a sparkling option to get the console really straight, and not the result of processing the command and returning to the home folder?
This means that if I somehow executed a command through PHP , then after that I remained in the last directory . Or do you need crutches for this?
cd /usr/local/bin && ./script.sh

M
MarkBogrov, 2020-12-28
@MarkBogrov

Perhaps it will be useful for future seekers, a similar topic How to get the program's response from the console to a variable?

M
Maxim K, 2020-12-28
@mkvmaks

Do monitoring systems also use web shell?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question