[GLLUG] Questions about shell scripting

David Lee Lambert davidl at lmert.com
Fri Jun 15 08:09:37 EDT 2012


Thanks for all the replies.

Looking at the bash manpage,  it looks like "%+" and "fg" are the tools
I need.  I just need to see if they can be used to build a maintainable
idiom.

The script I'm writing would be deployed on RHEL5, and the target
environment is already running JBoss.  The languages I could use, 
ordered from most-acceptable to least-acceptable (to management), are:

1.  Java (except then I might need another script to set up the
classpath and invoke "java" with the right arguments)

2.  Bash or Korn shell

3.  perl or python (as long as I use only vendor-supplied modules,  that
is,  what comes with RedHat;  random stuff from CPAN would technically
require a long approval process from some lawyers).

4.  C

5.  Any other language

So while C allows the most flexibility in handling the signals that
could come from the children,  I/O redirection,  etc.,  it's low on the
list for other reasons. 


Mike Szumlinski wrote:
> The way I've always worked around asynchronous calls in shell is by building multiple shell scripts and then firing "monitor" scripts that poll a file in the filesystem with information.
>
> As Clay said, it is far from optimal, but sometimes you only have certain tools to work with so you have to make due.
>
> On Jun 15, 2012, at 6:59 AM, Clay Dowling wrote:
>
>   
>> On 6/14/2012 6:20 PM, David Lee Lambert wrote:
>>     
>>> 2 quick questions:
>>>
>>> 1:  Is it possible to run a shell function in the background with "&"?
>>>
>>> 2:  What's a good idiom for starting several jobs in the background,  then waiting for them all to complete,  returning nonzero and printing an error if any of them fail?
>>>
>>>       
>> This doesn't sound like a great task for a shell script.  A python script or C program, on the other hand, can do this without breaking a sweat if you look up process control in any manual (either the Python book by O'Rielly or "Programming in the Unix Environment").
>>
>> Clay
>> _______________________________________________
>> linux-user mailing list
>> linux-user at egr.msu.edu
>> http://mailman.egr.msu.edu/mailman/listinfo/linux-user
>>     
>
> _______________________________________________
> linux-user mailing list
> linux-user at egr.msu.edu
> http://mailman.egr.msu.edu/mailman/listinfo/linux-user
>   


-- 
David L. Lambert <davidl at lmert.com> or <lamber45 at msu.edu>
  or <david.lee.lambert at acm.org>, formerly "as4109 at wayne.edu"
IM: davidleelambert (Yahoo!) or lamber45 at cse.msu.edu (MSN)
Phone:  616-676-7375

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.egr.msu.edu/mailman/public/linux-user/attachments/20120615/78902dd2/attachment.html>


More information about the linux-user mailing list