-1

I made a shell script to install web project on server when customer press a button on website.

I'm running command through the larval jobs

exec("/home/foldername/installation.sh

this shell script contains;

  • creating folder
  • creating database and import sql file
  • creating virtual host for domain.(with sudo)
  • restarting the web server. (with sudo)

Everything works. I want to show the realtime output of this shell script to the customer. How can I achieve that?

I tried symphony process. but it is not allow me to run sudo httpd restart and creating files in the root folder.

0

1 Answer 1

1

You could use Symfony\Component\Process\Process class to wrap your script and be able to set a callback to handle the real-time output. Combined to websocket broadcasting, you're able to show it on your website.

Here is the official documentation: https://symfony.com/doc/current/components/process.html#getting-real-time-process-output

Sign up to request clarification or add additional context in comments.

6 Comments

How do you know he is using symfony? Not mentioned in his question. This should be a comment IMHO.
I tried Symfony. sudo command not work
@Nic3500 he's using Laravel, so he automatically got Symfony classes in his vendor because Laravel is built upon Symfony
@Shizzen83 can I restart web server with Symfony process?
Depending on where you run this from, yes you could.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.