Parallel process in bash scripts.

Bash - parallel process.

Hi all.
I wrote script automation install GUI. He has next lines:
Code:
. . .
which openbox | awk '{print "exec " $1}' > $HOME/.xinitrc
	
Xorg –configure
Xorg –config /root/xorg.conf.new –retro

cd /root/
cp xorg.conf.new /etc/X11/xorg.conf

But, after run
Code:
Xorg –config /root/xorg.conf.new –retro
run GUI and script stops. Last two commands do not run.
I must click (Ctrl+Alt+F2), login, and manually carry them out.

How can I be?

Thank you.
 
doorways said:
Code:
Xorg –configure [red](1)[/red]
Xorg –config /root/xorg.conf.new –retro[red](2)[/red]
But, after run
Code:
Xorg –config /root/xorg.conf.new –retro
run GUI and script stops.
Actually, it doesn't "stop". You started a new process (line 2) in the foreground so your script waits for that to finish (in other words, it waits for your X session to terminate).

I suggest you do the file copying between both Xorg commands (i.e. between lines 1 and 2).

Hope this helps,

Fonz
 
Originally Posted by fonz
Actually, it doesn't "stop". You started a new process (line 2) in the foreground so your script waits for that to finish (in other words, it waits for your X session to terminate).

Yes. I thought so. My English is a little weak. I could not describe the situation - opened only the essence. But thank you.

Originally Posted by fonz
I suggest you do the file copying between both Xorg commands (i.e. between lines 1 and 2).

This is not an exit with the situation.
1. Why copy /root/xorg.conf.new until run command Xorg-config /root/xorg.conf.new-retro?
2. At the end of the script will be added to command shutdown-r now.
With this decision, it will fail.

How can I start a new process without suspending the script?
 
doorways said:
How can I start a new process without suspending the script?
Add an ampersand (&) to the end of the line:
Code:
Xorg –config /root/xorg.conf.new –retro [b][red]&[/red][/b]
However, if you add a shutdown(1) command after that, it will kill everything off, which might not be what you want either.

Fonz
 
Originally Posted by fonz
Add an ampersand (&) to the end of the line:

Oh, yes. It seems it works. Thank you. Thank you very much.
I close this theme when it's going to work on this script.

Tested as follows:
1. Run OpenBox
2. Created a script

Code:
#!/bin/sh
#

xterm &
xterm &
# end file.
After performing to run two terminals - the parent console continues to be responsible. Thank you.
 
Back
Top