Jalon windows
Aller à la navigation
Aller à la recherche
| Fiche express | |
|---|---|
| Type | Modèle de script batch |
| Principe | Reprise sur incident par jalons |
| Mécanisme | goto :JALON_%numero%
|
| Voir aussi | Batch · Syntaxe batch |
Un jalon (checkpoint) permet à un traitement batch de reprendre son exécution à
une étape précise après un incident, plutôt que de tout recommencer. Le script se branche
directement sur l'étiquette :JALON_nn correspondant au dernier jalon atteint, dont le
numéro est conservé dans une variable (ici %S_NUMJALON%, généralement positionnée par
l'ordonnanceur).
Modèle de script
@echo on
goto JALON_%S_NUMJALON%
path=%path%;%DIR%
:JALON_00
uxset step 0
echo 00
if not %errorlevel% == 0 goto error
:JALON_01
uxset step 1
echo "01"
if not %errorlevel% == 0 goto error
:JALON_99
uxset step 99
goto fin_OK
rem ======================
:fin_OK
set resexe=0
echo 'le code retour est : %errorlevel% '
exit 0
:error
set resexe=1
echo 'le code retour est : %errorlevel% '
exit 1
Bypass d'un job déjà terminé
Test permettant d'ignorer un job dont le dernier jalon (99) est déjà atteint :
::Test si Jalon 99
if %S_NUMJALON% == 99 (
SET RESEXE=0
Echo Reprise en Jalon 99 : Bypass du job.
Exit 0
GOTO:EOF
)
Voir aussi
- Batch — recueil de scripts batch
- Syntaxe batch — branchements
gotoet codes retour