> Linux > Linux Setup
Various Topics Home | Disclaimer | Report Adult Posts

Various Topics on Linux Setup



Linux Setup - "bash script goes too fast" in Linux


Old 02-14-2004   #1
..t ..ist..
 
Default Re: bash script goes too fast

On Sat, 14 Feb 2004 17:44:45 +0000, charly wrote:

> 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

 
Old 02-14-2004   #2
..ar..
 
Default bash script goes too fast

Greetins,

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 !
 

« Linux printing | - »
Thread Tools
Display Modes





Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0