Last change
on this file since 62495 was 45594, checked in by vboxsync, 12 years ago |
export retry.cmd.
|
-
Property svn:eol-style
set to
CRLF
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.4 KB
|
Line | |
---|
1 | @echo off
|
---|
2 | rem $Id: retry.cmd 45594 2013-04-17 17:23:21Z vboxsync $
|
---|
3 | rem rem @file
|
---|
4 | rem Windows NT batch script that retries a command 5 times.
|
---|
5 | rem
|
---|
6 |
|
---|
7 | rem
|
---|
8 | rem Copyright (C) 2009-2013 Oracle Corporation
|
---|
9 | rem
|
---|
10 | rem This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | rem available from http://www.virtualbox.org. This file is free software;
|
---|
12 | rem you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | rem General Public License (GPL) as published by the Free Software
|
---|
14 | rem Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | rem VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | rem hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | rem
|
---|
18 |
|
---|
19 | rem
|
---|
20 | rem Note! We're using %ERRORLEVEL% here instead of the classic
|
---|
21 | rem IF ERRORLEVEL 0 GOTO blah because the latter cannot handle
|
---|
22 | rem the complete range or status codes while the former can.
|
---|
23 | rem
|
---|
24 | rem Note! SET changes ERRORLEVEL on XP+, so we have to ECHO
|
---|
25 | rem before incrementing the counter.
|
---|
26 | rem
|
---|
27 | set /a retry_count = 1
|
---|
28 | :retry
|
---|
29 | %*
|
---|
30 | if %ERRORLEVEL% == 0 goto success
|
---|
31 | if %retry_count% GEQ 5 goto give_up
|
---|
32 | echo retry.cmd: Attempt %retry_count% FAILED(%ERRORLEVEL%), retrying: %*
|
---|
33 | set /a retry_count += 1
|
---|
34 | goto retry
|
---|
35 |
|
---|
36 | :give_up
|
---|
37 | echo retry.cmd: Attempt %retry_count% FAILED(%ERRORLEVEL%), giving up: %*
|
---|
38 | set retry_count=
|
---|
39 | exit /b 1
|
---|
40 |
|
---|
41 | :success
|
---|
42 | if %retry_count% NEQ 1 echo retry.cmd: Success after %retry_count% tries: %*!
|
---|
43 | set retry_count=
|
---|
44 | exit /b 0
|
---|
45 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.