From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 82884 invoked by alias); 14 Jul 2017 05:31:53 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 79355 invoked by uid 89); 14 Jul 2017 05:28:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=ls, Bryan, bryan, sk:project X-HELO: mail.spocom.com Received: from mail.spocom.com (HELO mail.spocom.com) (206.63.224.240) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Jul 2017 05:28:49 +0000 Received: from localhost (97-114-78-206.spok.qwest.net [97.114.78.206]) by mail.spocom.com with SMTP; Thu, 13 Jul 2017 22:27:39 -0700 Date: Fri, 14 Jul 2017 05:31:00 -0000 From: Gary Johnson To: cygwin@cygwin.com Subject: Re: How to repeat a bash shell script until success Message-ID: <20170714052736.GA2895@phoenix> Mail-Followup-To: cygwin@cygwin.com References: <97021E71-D804-42AF-8358-6276AF4514AB@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <97021E71-D804-42AF-8358-6276AF4514AB@gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes X-SW-Source: 2017-07/txt/msg00229.txt.bz2 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. Regards, Gary -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120411 invoked by alias); 14 Jul 2017 05:46:22 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 116867 invoked by uid 89); 14 Jul 2017 05:44:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=unavailable version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: mail.spocom.com Received: from mail.spocom.com (HELO mail.spocom.com) (206.63.224.240) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Jul 2017 05:44:08 +0000 Received: from localhost (97-114-78-206.spok.qwest.net [97.114.78.206]) by mail.spocom.com with SMTP; Thu, 13 Jul 2017 22:27:39 -0700 Date: Fri, 14 Jul 2017 13:06:00 -0000 From: Gary Johnson To: cygwin@cygwin.com Subject: Re: How to repeat a bash shell script until success Message-ID: <20170714052736.GA2895@phoenix> Mail-Followup-To: cygwin@cygwin.com References: <97021E71-D804-42AF-8358-6276AF4514AB@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <97021E71-D804-42AF-8358-6276AF4514AB@gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes X-SW-Source: 2017-07/txt/msg00230.txt.bz2 Message-ID: <20170714130600.4G51a82PYIfkwU45smM5-vT6bRnBKjwfxlpGinzpFhg@z> 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. Regards, Gary -- 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