Home > other >  Execute Each Line of Bash Script In Separate Terminals
Execute Each Line of Bash Script In Separate Terminals

Time:10-11

I have create a simple bash script for my laravel project (file name: bash-script.sh)

php artisan serv

php artisan queue:work --queue=first_queue

php artisan queue:work --queue=second_queue

php artisan queue:work --queue=third_queue

php artisan queue:work --queue=fourth_queue

php artisan schedule:work

the problem is I want each line of these commands to run in separate terminals.

CodePudding user response:

If you want them to run in a terminal window, you will have to start a terminal window.

xterm -e "php artisan serv"
xterm -e "php artisan queue:work --queue=first_queue"
xterm -e "php artisan queue:work --queue=second_queue"

# et cetera

CodePudding user response:

Or if you do not have a graphic environment on the host (ie you connect to the remote host via ssh) you need a terminal multiplexer like screen or tmux

For both, there are several howto and example all over the web

  • Related