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

Ron Frazier (ALE) atllinuxenthinfo at techstarship.com
Thu Apr 18 14:00:45 EDT 2013


Hi Scott, Phil, and all,

I've added the &>/dev/null to the lines of my start miners script and the disown command at the end as Phil recommended.  That falls into the "I'm doing it because you guys say it's important." category, since I don't pretend to understand the internal functioning of bash.  I do appreciate the tip though.  The script visually appears to be working the same as it was.

I also added a 5 second timeout to the start miners script in the read command at the end.  Now, the master script starts up it's children, then disowns them, then vanishes.  Just what I wanted it to do.

Thanks everyone for the help.

Sincerely,

Ron



Scott Plante <splante at insightsys.com> wrote:

>">&" (or "&>") together mean send standard out and standard error to
>the following file. They will get interpreted by the shell not get
>passed into mate-terminal. In other words, it's the std out/err of
>mate-terminal itself being sent to /dev/null. I don't know if
>mate-terminal actually generates any std out/err but it couldn't hurt.
>The second & by itself is the background one. 
>
>
>Scott 
>----- Original Message -----
>
>From: "Ron Frazier (ALE)" <atllinuxenthinfo at techstarship.com> 
>To: "Atlanta Linux Enthusiasts" <ale at ale.org> 
>Sent: Thursday, April 18, 2013 10:50:44 AM 
>Subject: Re: [ale] how do I - icon starts script starts 4 scripts 
>
>Hi Phil, 
>
>Thanks for the note. I'll look up the disown command. 
>
>Wouldn't using >/dev/nul send all the output of my sub scripts to a 
>black hole instead of their terminal windows? I wouldn't be able to see
>
>their output then. 
>
>Also, why did you suggest a second "&" command? 
>
>Sincerely, 
>
>Ron 
>
>
>On 4/18/2013 8: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 
>> 
>> 
>> 
>> HTH, 
>> 
>> 
>
>
>-- 
>
>(PS - If you email me and don't get a quick response, you might want to
>
>call on the phone. I get about 300 emails per day from alternate energy
>
>mailing lists and such. I don't always see new email messages very
>quickly.) 
>
>Ron Frazier 
>770-205-9422 (O) Leave a message. 
>linuxdude AT techstarship.com 
>Litecoin: LZzAJu9rZEWzALxDhAHnWLRvybVAVgwTh3 
>Bitcoin: 15s3aLVsxm8EuQvT8gUDw3RWqvuY9hPGUU 
>
>_______________________________________________ 
>Ale mailing list 
>Ale at ale.org 
>http://mail.ale.org/mailman/listinfo/ale 
>See JOBS, ANNOUNCE and SCHOOLS lists at 
>http://mail.ale.org/mailman/listinfo 
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Ale mailing list
>Ale at ale.org
>http://mail.ale.org/mailman/listinfo/ale
>See JOBS, ANNOUNCE and SCHOOLS lists at
>http://mail.ale.org/mailman/listinfo


--

Sent from my Android Acer A500 tablet with bluetooth keyboard and K-9 Mail.
Please excuse my potential brevity if I'm typing on the touch screen.

(PS - If you email me and don't get a quick response, you might want to
call on the phone.  I get about 300 emails per day from alternate energy
mailing lists and such.  I don't always see new email messages very quickly.)

Ron Frazier
770-205-9422 (O)   Leave a message.
linuxdude AT techstarship.com
Litecoin: LZzAJu9rZEWzALxDhAHnWLRvybVAVgwTh3
Bitcoin: 15s3aLVsxm8EuQvT8gUDw3RWqvuY9hPGUU




More information about the Ale mailing list