LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   RSYNC and BASH (https://www.linuxquestions.org/questions/linux-networking-3/rsync-and-bash-415149/)

chris28 02-13-2006 10:21 PM

RSYNC and BASH
 
Hello

I need to write a bash script to do automated backups of various files via rsync over ssh.
will bash start the 1st rsync transfer, and the start the next one after the first has finished,
or will is rush threw the script and rapidly start all the rsync transfers.
Do I need to add in some sort of delay in to the bash?


Thanks
Chris

gilead 02-13-2006 10:39 PM

Do you have one script with a series of rsync commands that aren't put into the background with '&'? If so, as far as I know bash will execute them sequentially and wait for the return code from each of them.

macemoneta 02-13-2006 10:42 PM

When running commands (whether manually or in a script) execution is synchronous. That is, control is not returned to the shell until the command execution completes. You can override this behavior by running commands as background processes (suffixing the command with an ampersand, '&').

So to directly answer your question, the rsync commands will run one at a time until they complete, unless you do something special to make them all run at the same time.

chris28 02-14-2006 04:21 PM

So, it won’t start the next rsync transfer until the previous one has finished?

Thanks
Chris

gilead 02-14-2006 04:31 PM

Correct - unless you force a task into the background, interactive shells and scripts wait for it to complete.


All times are GMT -5. The time now is 07:54 AM.