Sponsored Content
Top Forums Shell Programming and Scripting Breaking "while read" also breaks the parent process Post 302437748 by pludi on Friday 16th of July 2010 04:37:25 AM
Old 07-16-2010
The reason your program is breaking is that the break will exit the loop, ending the read, which sends a SIGPIPE to myprogram, which usually is an exit condition.

Do you have influence on the code of the program being started? If so, have it create a file once it's done, for which you can wait.

If not you'll have to put the reading loop into the background, and have it signal the main program once it's done. Something like
Code:
#!/bin/sh

waiting=1
ppid=$$

trap waiting=0 USR1

(
  ./myprogram | while read -r
  do
    [[ "$REPLY" == "up and running" ]] && kill -USR1 $ppid
  done
) &

printf "Waiting for startup"
while [ $waiting -eq 1 ]
do
  printf '.'
  sleep 1
done
echo

: # Stuff to be done here

wait #Wait for "myprogram" to exit

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to request a "read" or "delivered" receipt for mails

Dears, I've written a script which allows me to send mails in different formats with different attaches. Now I still want to add a feature to this script. My users would like to be able to receive a "read" or "delivered" receipt for their mails. The script send mails on behalve of an specific... (1 Reply)
Discussion started by: plelie2
1 Replies

2. Shell Programming and Scripting

Breaking input with "read" command

In this post, Perderabo's script says echo 05/06/25 14:15:56 | IFS=" /:" read Y1 M1 D1 h1 m1 s1 which, if I am not wrong, will break the input into Y1, M1 et al. I tried the following in my code #! /bin/ksh # per.sh typeset -R2 HOUR=00 typeset -R2 MIN=00 typeset -R2 SEC=00 ... (2 Replies)
Discussion started by: vino
2 Replies

3. Shell Programming and Scripting

read -p "prompt text" foo say "read: bad option(s)" in Bourne-Shell

Hallo, i need a Prompting read in my script: read -p "Enter your command: " command But i always get this Error: -p: is not an identifier When I run these in c-shell i get this error /usr/bin/read: read: bad option(s) How can I use a Prompt in the read command? (9 Replies)
Discussion started by: wiseguy
9 Replies

4. Red Hat

"service" , "process" and " daemon" ?

Friends , Anybody plz tell me what is the basic difference between "service" , "process" and " daemon" ? Waiting for kind reply .. .. (1 Reply)
Discussion started by: shipon_97
1 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

Purpose of "read" and "$END$" in ksh ?

Hi, Could anyone please shed some light on the following script lines and what is it doing as it was written by an ex-administrator? cat $AMS/version|read a b verno d DBVer=$(/usr/bin/printf "%7s" $verno) I checked that the cat $AMS/version command returns following output: ... (10 Replies)
Discussion started by: dbadmin100
10 Replies

7. Shell Programming and Scripting

Read from "list1" and list matches in "list2"

I want to print any matching IP addresse in List1 with List 2; List 1 List of IP addresses; 161.85.58.210 250.57.15.129 217.23.162.249 74.76.129.101 30.221.177.237 3.147.200.59 170.58.142.64 127.65.109.33 150.167.242.146 223.3.20.186 25.181.180.99 2.55.199.32 (3 Replies)
Discussion started by: lewk
3 Replies

8. Shell Programming and Scripting

While loop breaking when using "ssh" command inside

Hi , I am trying to read a list of hosts from a config file and trying to get file list from that host. For this I have used one while loop. cat "$ARCHIVE_CFG_FILE" | sed '/^$/d' | sed '/^#/d' | while read ARCHIVE_CFG do SOURCE_SERVER_NAME=`echo "$ARCHIVE_CFG" | awk -F '|' '{ print... (2 Replies)
Discussion started by: Anupam_Halder
2 Replies

9. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies
condor_compile(1)					      General Commands Manual						 condor_compile(1)

Name
       condor_compile create - a relinked executable for submission to the Standard Universe

Synopsis
       condor_compile cc | CC | gcc | f77 | g++ | ld | make | ...

Description
       Use  condor_compile to relink a program with the Condor libraries for submission into Condor's Standard Universe. The Condor libraries pro-
       vide the program with additional support, such as the capability to checkpoint, which is required in Condor's  Standard	Universe  mode	of
       operation.  condor_compile  requires  access  to the source or object code of the program to be submitted; if source or object code for the
       program is not available (i.e. only an executable binary, or if it is a shell script),  then  the  program  must  submitted  into  Condor's
       Vanilla	Universe. See the reference page for condor_submitand/or consult the "Condor Users and Administrators Manual" for further informa-
       tion.

       To use condor_compile, simply enter "condor_compile" followed by whatever you would normally enter to compile or link your application. Any
       resulting executables will have the Condor libraries linked in. For example:

	      condor_compile  cc -O -o myprogram.condor file1.c file2.c ...

       will  produce  a  binary "myprogram.condor" which is relinked for Condor, capable of checkpoint/migration/remote-system-calls, and ready to
       submit to the Standard Universe.

       If the Condor administrator has opted to fully install condor_compile, then condor_compilecan be followed by  practically  any  command	or
       program, including make or shell-script programs. For example, the following would all work:

	      condor_compile  make

	      condor_compile  make install

	      condor_compile  f77 -O mysolver.f

	      condor_compile  /bin/csh compile-me-shellscript

       If  the	Condor administrator has opted to only do a partial install of condor_compile, the you are restricted to following condor_compile-
       with one of these programs:

	      cc (the system C compiler)

	      c89 (POSIX compliant C compiler, on some systems)

	      CC (the system C++ compiler)

	      f77 (the system FORTRAN compiler)

	      gcc (the GNU C compiler)

	      g++ (the GNU C++ compiler)

	      g77 (the GNU FORTRAN compiler)

	      ld (the system linker)

       NOTE: If you use explicitly call ``ld'' when you normally create your binary, simply use:

	      condor_compile  ld <ld arguments and options>

       instead.

Exit Status
       condor_compileis a script that executes specified compilers and/or linkers. If an error is encountered before calling these other programs,
       condor_compilewill exit with a status value of 1 (one). Otherwise, the exit status will be that given by the executed program.

Author
       Condor Team, University of Wisconsin-Madison

Copyright
       Copyright  (C)  1990-2012  Condor  Team,  Computer  Sciences Department, University of Wisconsin-Madison, Madison, WI. All Rights Reserved.
       Licensed under the Apache License, Version 2.0.

       See the Condor Version 7.8.2 Manualor http://www.condorproject.org/licensefor additional notices. condor-admin@cs.wisc.edu

								  September 2012						 condor_compile(1)
All times are GMT -4. The time now is 08:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy