All Questions

Filter by
Sorted by
Tagged with
0
votes
0answers
36 views

Background processes in bash preserving order

From a GUI terminal emulator running bash, I would like to open a tabbed instance, get its X window ID, and use it to embed four st terminal instances inside tabbed, with titles from 1 to 4, in ...
3
votes
2answers
191 views

Terminate second (parallel) process if first one is terminated

Let's assume we have two shell scripts running in parallel driver.sh: ./proc1.sh& ./proc2.sh& how can I terminate a process if the other one exited with non-zero code? (terminate driver.sh)
0
votes
1answer
1k views

lock bash script to prevent parallel running from within the script itself?

I am aware of using flock and solo (not sure the difference though) when running from a cron job. However, is it possible to prevent parallel running from within the script itself?
11
votes
4answers
3k views

How to atomically allocate a loop device?

I am writing some shell scripts to handle some disk image stuff, and I need to use loop devices to access some disk images. However, I am not sure how to properly allocate a loop device without ...
1
vote
2answers
507 views

Background processes mix up order of shell script execution

Can someone explain me why the script echo one && echo two & echo three && echo four gives me [1] 3692 three four one two [1]+ Done echo one && ...
2
votes
2answers
501 views

Linux lockfile starvation

I want to use lockfile functionality for a bash script that will run in parallel. The problem is that in a functionality as in the script below, a starvation can happen in case that the first one to ...
1
vote
2answers
2k views

How to run “&” operation sequentially

From my script I am running following commands: SCRIPT_1="ksh -x script1.sh & ksh -x script2.sh"; SCRIPT_2="ksh -x script3.sh & ksh -x script4.sh"; eval $SCRIPT_1; sleep 20s; eval $...
1
vote
1answer
2k views

Running commands after ampersand symbol & in a remote ssh session

I have a shell script that initiates a long, resource-intensive command on several different machines. In order to execute the script on each machine in parallel, I have an ampersand symbol after ...
4
votes
3answers
2k views

pipe line with non-deterministic output

I have happened upon a command that sometimes works and sometimes does not, even when executed multiple times in rapid succession in a bash shell (I have not tested the behavior in other shells). The ...
3
votes
1answer
1k views

Controlling bash script concurrency, flock inheritance

I have a bash deployment script that handles deploying updated code to a Tomcat instance on CentOS, however, both Chef and RunDeck may invoke the script, and since Chef runs periodically there is a ...
12
votes
2answers
6k views

communication between multiple processes

I have a bash script, which runs manager() function as a separate process for x-times. How is it possible to forward messages to all manager() processes from within the script? I've read about ...
-3
votes
1answer
1k views

Run series of command independent of each other

If I have a file with cmd1 cmd2 cmd3 And I want to run them independent of each other, and independent whether it outputs an exit status or not (that means do not expect to end, just keep ...