2

I have 3 bash commands/files that I need to launch on seperate terminals when my ubuntu 20 machine startups

$ ./script1
$ ./script2
$ ./script3

I want all these 3 script to run in each separate terminals.

Sample Contents of script:

#!/bin/bash

cd /var/www/html/myproject php -S 192.168.10.222:8080 -t public/

  • I guess it would be better for you to install some real web server ... – pLumo Jan 26 '21 at 13:04
  • 1
    You mean they have to run in GNOME terminal windows? It is not possible until you log in and the graphics environment starts, so not at machine startup, because there's no user logged in and no GUI yet at that time. Why do these commands need to run in separate terminals? Do they produce any output that you need to see? Can you just redirect that output to a file? – raj Jan 26 '21 at 13:06
  • 1
    There is no version 20 of Ubuntu. It has to be 20.04 or 20.10 – David Jan 26 '21 at 13:17
  • This question appears to be aimed for the text console, i.e. no graphical user interface running. Please clarify that in your question. – vanadium Jan 27 '21 at 08:57
  • These seem to be web application servers. Given they are server processes I think you would be better off making a systemd unit file for them rather than trying to run them in terminals. You should be able to make a templated unit file so you just need one unit for as many different app servers as you like. See https://ibug.io/blog/2019/07/systemd-service-template/ for more on that. If you don't want to go that way I think you'd be better off installing a real web server, e.g. apache. There's ways to do what you're asking for, but for web app servers it's not a good fit. – grifferz Jan 27 '21 at 22:04

1 Answers1

0

create some "main script" with this code:

 #!/bin/bash
 konsole --noclose  -e /bin/bash /path/to/my/script1 &
 konsole --noclose  -e /bin/bash /path/to/my/script2 &
 konsole --noclose  -e /bin/bash /path/to/my/script3

and put path to "main script" in your .bashrc

That will start all your 3 scripts in separate terminals after your login in Ubuntu

user216
  • 100