&& on that one does not help when running from cron (read the comments on 
the stackoverflow thread as it is explained there).

wait is not helping either as it is per PID and the detached processes 
spawned by git clone run under different PIDs, so parent exits and there is 
no notification on child processes anymore.

On Wednesday, 25 May 2016 18:10:08 UTC+2, Konstantin Khomoutov wrote:
> On Wed, 25 May 2016 07:52:10 -0700 (PDT) 
> Sandor Hadas <sandorh...@gmail.com <javascript:>> wrote: 
> > I have a shell script what does a "git clone" and then some 
> > operations on the repo cloned. It works fine when run from the 
> > command line. 
> > 
> > However, if the very same script is added to cron then what happens: 
> > 1. Cron starts the script 
> > 2. Script invokes git clone 
> > 3. git clone spawns several "git-remote-https" processes 
> > 4. git returns while the spawned processes run 
> > 5. Commands based on the repo fail (if I add a sleep 30 before 
> > running the commands then success, but that cannot be the right path) 
> > 
> > How do I make sure that a git clone is actually complete when running 
> > from cron OR how do I make git run synchronously so that it does not 
> > return control to the bash before it is really done (nohup did not 
> > work because of the detached spawns)? 
> If [1] is your question repeated on SO (with much more useful details), 
> then the problem is that you're using '&' after `git clone` while 
> supposedly you should have used '&&'. 
> If you indeed wanted -- for some unknown reason -- to actually 
> background the `git clone` process, then you have to call `wait` later 
> in the script to wait for the child processes to finish. 
> 1. http://stackoverflow.com/q/37437007/720999 

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to