-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.

Shankar S Bavan
  • 922
  • 1
  • 12
  • 32

1 Answers1

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

Shizzen83
  • 3,325
  • 3
  • 12
  • 32