0

I am using Ubuntu 18.04.3 LTS.

Currently to start my development environment I have to run each of the below commands in terminal:

sudo systemctl stop apache2

sudo /opt/lampp/manager-linux-x64.run

sudo /opt/PhpStorm-193.6015.48/bin/phpstorm.sh 

sudo chmod -R 777 Desktop/Code/testProject

I would love to double click on a script on my desktop and automatically spawn the two terminals that need to run in the background for lampp and phpstorm

However, when currently executing the script it only starts the lampp-server.

Any suggestions what I am doing wrong?

I appreciate your replies!

1 Answer 1

1

That is expected behavior for Bash. It sequentially processes commands and waits for the previous one to complete before it continues. But if it doesn't end then it's stuck in limbo waiting.

What you can do, if you don't mind not seeing one of the processes is run the command followed by an & symbol. This will start it as a sub process so you won't see it but it will be running in the background.

For example: sudo /path/to/command.sh &

If you need it to be visible you can run it as such gnome-terminal -e command. This should open another terminal window and run the specified process in that window leaving your previous window to continue on as it should.

Your script could look something like this.

sudo systemctl stop apache2

sudo gnome-terminal -e /opt/lampp/manager-linux-x64.run

sudo /opt/PhpStorm-193.6015.48/bin/phpstorm.sh 

sudo chmod -R 777 Desktop/Code/testProject
2
  • Thx for your answer! What do you mean by running it with the &? How would the script look like?
    – Carol.Kar
    Apr 3, 2020 at 20:38
  • 1
    Added an example. Hope it helps!
    – Robby1212
    Apr 3, 2020 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.