parallel bash scripts

bruce badouglas at gmail.com
Wed Mar 28 01:14:52 UTC 2012


hey rick...

haven't talked to you in a very long time!

--
i tried the nohup, but couldn't get it to work because of the fact
that my processes have infinite loops.. so my test never got beyond
running the 1st test shell script that's running an infinite loop...

i can do a paste of what i'm testing if you have a few minutes to take
a look on this

thanks

bruce
badouglas at gmail.com



On Tue, Mar 27, 2012 at 8:56 PM, Rick Stevens
<rstevens at corp.alldigital.com> wrote:
> On 03/27/2012 04:06 PM, bruce wrote:
>>
>> dave..
>>
>> thanks.
>>
>> but the script is a long running script, and i want to see the output
>> as the script is running without having to hit the keyboard..
>>
>> so doing a tail of the file while the process is running isn't what
>> i'm looking for.
>>
>> anything else?
>
>
> The problem is that a script wants a stdin, stdout and stderr. If
> you're going to run them in parallel, you can't very well have both
> scripts outputting to the terminal.
>
> The correct thing is to do what Dave said. Use nohup and redirect stdout
> and stderr to a log file. You can then "tail -f" each one whenever you
> want. An alternative is to launch the scripts in detached screen
> sessions:
>
>        screen -d -m dog.sh
>        screen -d -m cat.sh
>
> This would launch each script in its own detached screen session
> (essentially creates virtual terminals with shells and runs the script
> in them) and the calling script doesn't wait for them to complete.
>
> You can then "screen -r <id>" to attach to those screen sessions. You
> can get the list of screen sessions running simply by doing "screen -r"
> without specifying a session ID. Use "ctrl-A, ctrl-D" to detach from
> a screen session (but leave it running). See "man screen" for details.
>
> Oh, yeah, you may need to "yum install screen" if you don't already have
> it.
>
>> On Tue, Mar 27, 2012 at 7:00 PM, Dave Ihnat<dihnat at dminet.com>  wrote:
>>>
>>> On Tue, Mar 27, 2012 at 06:06:56PM -0400, bruce wrote:
>>>>
>>>> anyway i can redirect the err/out to the stdout.. instead of the
>>>> nohut.out file??
>>>
>>>
>>> The usual way would be to do a tail -f on the output file, e.g.,
>>>
>>> Â nohup cat.sh 2>&1>cat.log
>>> Â tail -f cat.log
>>>
>>>
>>> If you're using bash, IIRC, you could reap the background ID and then use
>>> 'disown', I suppose. Â "$!" should give you that.
>>>
>>> Cheers,
>>> --
>>> Â  Â  Â  Â Dave Ihnat
>>> Â  Â  Â  Â President, DMINET Consulting, Inc.
>>>
>>> --
>>> users mailing list
>>> users at lists.fedoraproject.org
>>> To unsubscribe or change subscription options:
>>> https://admin.fedoraproject.org/mailman/listinfo/users
>>> Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
>>> Have a question? Ask away: http://ask.fedoraproject.org
>
>
>
> --
> ----------------------------------------------------------------------
> - Rick Stevens, Systems Engineer, AllDigital    ricks at alldigital.com -
> - AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
> -                                                                    -
> -      We are born naked, wet and hungry. Then things get worse.     -
> ----------------------------------------------------------------------
>
> --
> users mailing list
> users at lists.fedoraproject.org
> To unsubscribe or change subscription options:
> https://admin.fedoraproject.org/mailman/listinfo/users
> Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
> Have a question? Ask away: http://ask.fedoraproject.org


More information about the users mailing list