delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/07/14/09:06:37

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=yj7vl4bOPCHlEVW1
R4PUvA8sRkH2wmWFf2YNmMkv8xkJXGxYvCXITOX4rjCGvKh7ar6PTOYlVTOfBy9K
7yuHiY9J3P007bdIxyvWYmAqUsk1I2+DORUvwpK6eAWDYdwZNe0sECIbkfqPGULN
Hsc6Mv3CuBC1PcZRAkrtKY0fyjU=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=lzRv0MEpC53YoVoX6aOLMi
cAzbU=; b=BUTRUK1Lhp4D2lRwgGh4MGSCugR/3r2ZAaqojz3grOPR4gT4Se2CsK
DaqIff2e9BBrpt2iUXRWy3n7z5NowQqJ+tDKLsEQM7s5JEDGicbOuPQonXtRxRZ2
tBLtrS5oDgmeKo7LhKKsyqCSx/jI7Rp+5ZECWEVabuo3oTaCKaD3o=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=interpretation, reality, HContent-Transfer-Encoding:8bit
X-HELO: mail-it0-f53.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=thdfCbI2An/6RwgmZJS7mMc/ha3mktBN5OP9R0Hvz1g=; b=fRJimcGGD7HJAEGkTJubgLPPbkg6GTlS4k08xOu408i9qdV33pKoX3Rz8Q7Q0o7Lj3 FcUg9XEUKSpIsQYVmOufTLNxoeyZ0CLl6Vff/OlGYnJ6fJub82Ch0DNa0jO0D5xwA468 gNI7N/eR/AECEULGHAAVib4foEFMVFqDMxCPCt+86RX8AFnINtARicytFuOz25SFGppL Tv64vq1/5cZZYBJZbWqIHvkCZbfYkvx6LNhX3PSblDJLfBU9WMxpTtOf68/tXc5Ugruy jgMzy8b735LSN1UzRAtdKnwN61V0VT438+ZmsSIPlcaWzEjvXxWwte/sUBhoFRzrt2xE uqgw==
X-Gm-Message-State: AIVw1101dpvy5LbITIVlUslm2cYAr+PXDmxpP6yteiK/xtm+r2LdHx9f 3VNS6HFjR+DaH/QN
X-Received: by 10.107.172.69 with SMTP id v66mr7818656ioe.127.1500037561690; Fri, 14 Jul 2017 06:06:01 -0700 (PDT)
Subject: Re: How to repeat a bash shell script until success
To: cygwin AT cygwin DOT com
References: <97021E71-D804-42AF-8358-6276AF4514AB AT gmail DOT com> <20170714052736 DOT GA2895 AT phoenix>
From: cyg Simple <cygsimple AT gmail DOT com>
Message-ID: <8bb16934-972b-5d3e-918f-36eec3d16ca6@gmail.com>
Date: Fri, 14 Jul 2017 09:06:02 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <20170714052736.GA2895@phoenix>
X-IsSubscribed: yes

On 7/14/2017 1:27 AM, Gary Johnson wrote:
> On 2017-07-12, Bryan Dunphy wrote:
>> I have a shell script, originally created for Mac OS X. that waits
>> for an external drive to be mounted (by testing an “ls” of the
>> volume’s root directory for success) then runs an “rsync” command.
>> How do I get the script to be run repeatedly until successful exit
>> under Cygwin?
>>
>> Here is the unmodified Mac OS version of the script:
>>
>> #!/bin/bash
>> if ls /Volumes/Shared >/dev/null 2>/dev/null
>> then
>>         rsync -avz --compress-level=9 --delete-during --partial --exclude 'cache/' aleph.gutenberg.org::gutenberg /Volumes/Shared/Project-Gutenberg
>>         exit 0
>> else
>>         exit 1
>> fi
> 
> Let the name of your script be "myscript".  The following will run
> myscript every two seconds until it succeeds.
> 
>     while ! myscript; do sleep 2; done
> 
> This is really a bash programming question and is not specific to
> Cygwin.
> 

In reality the OP script appears to be executed in a crontab system and
executed every X minutes.  So a change to the OP question is needed
which is answered at[1].  Let's remember some people have no real clue
as to what question they should ask and we need to interpret what is
being asked into what should have been asked.  If interpretation isn't
possible then asking for a use case would be warranted.

[1]
https://stackoverflow.com/questions/707184/how-do-you-run-a-crontab-in-cygwin-on-windows

-- 
cyg Simple

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019