Create a multi starter

Asked by Rob Frerejean

I use 4 different programs at the same time. I would like to create a start file which starts them all together. How to do that?

I don´t want them to start at boot. That I know how to do.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu bash Edit question
Assignee:
No assignee Edit question
Solved by:
Brewster Malevich
Solved:
Last query:
Last reply:
Revision history for this message
Brewster Malevich (brews) said :
#1

Do you mind me asking what programs you are trying to start? You might be able to do this with a simple bash script.

Revision history for this message
Rob Frerejean (hffrerejean) said :
#2

Yes, that´s what I want, but I don´t know how to do that.

I can create a file. But I don´t know what to put in it.

The names of the programs are irrelevant.

Revision history for this message
Rob Frerejean (hffrerejean) said :
#3

I created a file and put something in it.

program1
program2
program3
program4

But if I do this, a terminal opens and only the first program is starting.

Guess I need to do it different.

Revision history for this message
Best Brewster Malevich (brews) said :
#4

Hmmm... ok.
So, lets say you want to launch Firefox and the Gimp at the same time (just for an example).

1) create the script file named: [whatever].sh
in this case: firegimp.sh

2) open up that file with a text editor of your choice and as your first line put the "hash-bang":
#! /usr/bin/env bash

3) Now we can enter bash shell commands untill our fingers blister. You can test these in real time by running them in the Terminal (Applications>Accessories>Terminal). Here, we will separate the names of the programs or commands we are running with " & " so that each command/program is (essentially) launched at the same time. For firegimp.sh we would have:
firefox & gimp

* So, just to check, the file firegimp.sh should look like this:

#! /usr/bin/env bash
firefox & gimp

4) Now save and close the file. And we need to give it permission to behave like a program, so, right-click on the file and select "Properties"; now go to the "Permissions" tab; and then check the box that says something along the lines of 'allow file to execute as program'...

You should now be able to double click on the script and have Firefox and the Gimp launch at the same time (oh, joy).

I hope this helps.
Read more at https://help.ubuntu.com/community/Beginners/BashScripting . You can also find loads more by googling something like "intro to bash scripting".

Revision history for this message
Rob Frerejean (hffrerejean) said :
#5

Works PERFECT. Learned something today. Only one thing. I did not add #. If I do, then nothing happens.

Thankx.

Rob

Revision history for this message
Rob Frerejean (hffrerejean) said :
#6

Thanks Brews, that solved my question.

Revision history for this message
Rob Frerejean (hffrerejean) said :
#7

O, sorry. Whaha, I did put an $. With # works fine.