Thanks for the help from Mr K S Braunsdorf .<br>This problem is caused by the opened pipe, which should have been closed, in the c++ program.<br><br><br>thanks<br>James Li<br><br><br><div class="gmail_quote">2010/11/11 jian li <span dir="ltr">&lt;<a href="mailto:lijian06nju@gmail.com">lijian06nju@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5">hi, all:<br>       I need to back up about 50 files, the size of which won&#39;t exceed 5m, every 10~15 minutes to four remote machines.<br>
<br>      
 The back up command is written in a shell script file and was executed 
by the scheduling program with system() function. The scheduling program
 is implemented with c++.<br>

       The command as follow:<br>         <i>rsync -az  /home/admin/service/* admin@10.249.49.101:/news_hot_data</i><br><br>      <b> At first, this works just fine.</b> But after about one or two days, rsync will stop at some place  and the whole backup process stuck.<br>



       The following is the output with -vv option when backup stop:<br>         <i>opening connection using: ssh -l admin 10.249.49.101 rsync --server -vvlogDtprze.isf . /news_hot_data</i><br><br>      
 I used strace to track the system call, and I found select() was 
invoked again and again, never end until the program was killed by 
ctrl+c. The following is the output:<br>

          ......<br>          18477 select(1027, [255 1024], [], NULL, NULL) = 1 (in [1024])                       <div>   <br>          18477 read(1024, &quot;\36\0\0\0&quot;, 16384)    = 4 <br>          18477 select(1027, [255 1024], [255], NULL, NULL) = 1 (out [255])<br>



          18477 write(255, &quot;]\306\304\2315\r\346\314\26]\2\275\350|X\305X\216\361\&quot;\301}\t\34\213\357GPS\360\214\370&quot;..., 48) = 48                                                         <br>          18477 select(1027, [255 1024], [], NULL, NULL) = 1 (in [255])<br>



          18477 read(255, &quot;l\210\377V\20\270\0270\276@\363N\366\n!\311\211\312\206\216\25\3\1\323\375\370\24\0174lM\312&quot;..., 8192) = 48<br>          18477 select(1027, [255 1024], [1025], NULL, NULL) = 1 (out [1025])                     <br>



          18477 write(1025, &quot;\35\0\0\0\335\226\333L&quot;, 8) = 8<br>          18477 select(1027, [255 1024], [], NULL, NULL &lt;unfinished ...&gt;                          <br>          18476 &lt;... select resumed&gt; )            = 0 (Timeout)<br>



          18476 select(1026, [], [], NULL, {60, 0}) = 0 (Timeout)<br>          18476 select(1026, [], [], NULL, {60, 0}) = 0 (Timeout)                                 <br>          18476 select(1026, [], [], NULL, {60, 0}) = 0 (Timeout)<br>



          18476 select(1026, [], [], NULL, {60, 0}) = 0 (Timeout)                                 <br>          18476 select(1026, [], [], NULL, {60, 0}) = 0 (Timeout)<br>          18476 select(1026, [], [], NULL, {60, 0}) = 0 (Timeout)                                 <br>



          18476 select(1026, [], [], NULL, {60, 0}) = 0 (Timeout)                                 <br>          18476 select(1026, [], [], NULL, {60, 0}) = 0 (Timeout)                                 <br>          18476 select(1026, [], [], NULL, {60, 0}) = 0 (Timeout)                                 <br>



          18476 select(1026, [], [], NULL, {60, 0}) = 0 (Timeout)                                 <br>          18476 select(1026, [], [], NULL, {60, 0}) = 0 (Timeout)                                 <br>           ......<br>



           I read the linux manual about select(), know it was used to 
wait something to be ready, but I don&#39;t know what exactly it is waiting,
 and it never will ready.<br>           <b>And what made me more confused is that when I execute the script in the terminal, it still works!</b><br>
       <br>           I have been confused for a few days and try to find out the reason by google, but failed.<br><br><br>thanks<br>James li</div>
</div></div></blockquote></div><br>