osx - bash wait for rsync to finish for proceeding -


hi wrote bash script backup procedure , monitor folder , sync target dir folder every month , changes mother dir every day.

i want second rsync process start after first has finished implemented wait command, doesn't work:

if [ ! -f $month_compare/monat-$month-compare.log ];    rsync -avh --force --delete --update --log-file=$month_compare/monat-$month-compare.log $source_loc $month_compare & fi wait  if [[ $month -eq 1] && [ $day -eq 1]];     rm -rf $backup_dir/$lastyear/12     mkdir $backup_dir/$lastyear/12      #compare changes of last month backup year month     rsync -avh --force --ignore-errors --log-file=$backup_dir/$lastyear/12/monat-$month.log --compare-des=$month_compare $source_loc $backup_dir/$lastyear/12 &&     #update aktuell day changes     rsync -avh --force --ignore-errors --delete --update --log-file=$backup_dir/$year/$month/$day/tag-$day.log --backup-dir=$backup_dir/$year/$month/$day $source_loc $target_dir &&     #update month compare folder da 1. des neuen monats     rsync -avh --force --ignore-errors --delete --update --log-file=$month_compare/monat-$month-compare.log $source_loc $month_compare & fi wait 

how accomplish this?

you running rsync in background (&) , waiting it. why not run (without &) , won't need wait. next command execute after first rsync finished.


Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

javascript - Confirm a form & display message if form is valid with JQuery -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -