|
|||||
|
|
#1 |
|
|
> tar cz /somedir -f somedir.tgz > then put via ftp somedir.tgz to a remote server. > > I can do all this with no pb on command line. > > When i make it via script, it tries to ftp the file while it is still > under construction -> file not found. That does not sound correct. According to your description ftp will not run until the tar is complete. > I could do it like this : > tar cz /somedir -f somedir.tgz & > ftp Now that will cause problems because the & will cause control to return to ftp before the tar is complete. > > but I tar several files in several archives and need to transfer all of > them then "rm" them. Ok, kick off all the tars, and create a loop which will watch for the last tar to complete. > Can someone tell me how can I make bash wait for tar processes to be done ? man pgrep You can use the return code from pgrep to control the while/until loop to know when all the tars are complete. loop syntax can be found at http://www.tldp.org/LDP/abs/html/index.html |
|
|
#2 |
|
|
Im trying to achieve the following thing : tar cz /somedir -f somedir.tgz then put via ftp somedir.tgz to a remote server. I can do all this with no pb on command line. When i make it via script, it tries to ftp the file while it is still under construction -> file not found. I could do it like this : tar cz /somedir -f somedir.tgz & ftp but I tar several files in several archives and need to transfer all of them then "rm" them. Can someone tell me how can I make bash wait for tar processes to be done ? thank you ! |