Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to start multiple application with a shell script,but have no idea how to do it.
Basically, i want to start the same application in different directories, say consumer1/app, consumer2/app, consumer3/app
The first will start the application in the background with all output redirected to "/dev/null". The second will disconnect the application from the terminal so it will not die when you exit your shell.
The first will start the application in the background with all output redirected to "/dev/null". The second will disconnect the application from the terminal so it will not die when you exit your shell.
the program you use to copy the application "cp" is invoked in the script just by its name, so wont the application you want to execute in different directories will also execute by just calling them by their executable name? or am i missing something? That is,
Code:
cp app ./dir1
app&
cp app ./dir1
app&
...
I guess you might want to be "nice" before you start all the programs so that everything runs with equal amount of cpu time.
The prog will be called by searching your $PATH, unless you specify a relative or absolute path.
Running a prog in different dirs can mean 1 of several things
1. run the (one version) of the prog and pass the dir to use as a cmd line param, if it accepts that method.
2. have a separate copy of the prog in each desired dir and cd into that dir and call it with ./prog
3. cd into the desired dir and call the prog via $PATH
4. cd into the desired dir and call the prog using an absolute path
5. cd into the desired dir and call the prog using a relative path
Incidentally, it's
prog &
not
prog&
to background a prog; note the space there.
To avoid the prog terminating when you logout, add nohup thus
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.