[ale] how do I - icon starts script starts 4 scripts

JD jdp at algoloma.com
Thu Apr 18 09:14:30 EDT 2013


The Advanced Bash Scripting Guide http://tldp.org/LDP/abs/html/ is a great
resource for anyone trying to learn bash scripting.  It can teach simple to
highly advanced techniques for bash scripting.

I believe that Dennis had a link to it in his "Bashing Linux" presentation last
week at ALE-NW.

I've been using bash for many, many years, but still learned a few new things
from Dennnis' talk. I'm certain if the weather had been better, we would have
had a packed room.


On 04/18/2013 08:54 AM, Phil Turmel wrote:
> Hi Ron,
> 
> On 04/17/2013 09:35 PM, Ron Frazier (ALE) wrote:
> 
>> #!/bin/bash -eu
>> # program to start all mining scripts
>> cd ~/mining-scripts
>> # commands to start the first miner
>> mate-terminal --geometry=70x4+1800+100 -t "Miner 1" -e ./miner1 &
>> # commands to start the second miner
>> mate-terminal --geometry=70x4+1800+250 -t "Miner 2" -e ./miner2 &
>> # commands to start the third miner
>> mate-terminal --geometry=70x4+1800+400 -t "Miner 3" -e ./miner3 &
>> # commands to start the fourth miner
>> mate-terminal --geometry=70x4+1800+550 -t "Miner 4" -e ./miner4 &
>> echo "Press enter to continue."
>> read junk
>>
>> I have to use mate-terminal to activate Mint's terminal emulator.  The
>> --geometry option (mentioned by both you and Brian) sets the window size
>> for each MINERx script as well as a location so they all stack up on the
>> right of my monitor.  The -t option specifies a unique title for each
>> window.  Each MINERx program is started with the "&" command (also
>> mentioned by you and Brian) so the master script keeps on going without
>> waiting.  For some reason, I had to put the read command at the end of
>> the START-MINERS script or the sub scripts never kick off.  I have no
>> idea why.
> 
> When a script ends, bash kills off any unfinished background tasks.  To
> avoid this, the script must explicitly "disown" them.  However, the
> background tasks that are still connected to the original terminal's
> file descriptors might suicide on the loss of those pipes.
> 
> I would rewrite your script as follows:
> 
> #!/bin/bash -eu
> # program to start all mining scripts
> cd ~/mining-scripts
> 
> # commands to start the first miner
> mate-terminal --geometry=70x4+1800+100 -t "Miner 1" -e ./miner1 &>/dev/null &
> 
> # commands to start the second miner
> mate-terminal --geometry=70x4+1800+250 -t "Miner 2" -e ./miner2 &>/dev/null &
> 
> # commands to start the third miner
> mate-terminal --geometry=70x4+1800+400 -t "Miner 3" -e ./miner3 &>/dev/null &
> 
> # commands to start the fourth miner
> mate-terminal --geometry=70x4+1800+550 -t "Miner 4" -e ./miner4 &>/dev/null &
> 
> # Disconnect the background tasks from this script
> disown -a
> 


More information about the Ale mailing list