troubleshooting Question

Batch File not executing Do - Loop - Maybe a vbscript will do ? Windows 2003 Server

Avatar of LindaC
LindaCFlag for Puerto Rico asked on
Windows Server 2003VB ScriptWindows Batch
30 Comments1 Solution748 ViewsLast Modified:
I have the following script but the DO - LOOP is only executing once and do not execut the "hot_CMDB_backup_end.bat".

I f the loop will execute like a loop then it will run perfectly.  The thing is that I don't know how to do it in batch file or maybe in vbscript?

Attached is the script.
set newDate=%date:~4,2%-%date:~7,2%-%date:~10%
set arg=CMDB

start C:\oracle\Dba\scripts\CMDB\hot_backup_scripts\hot_CMDB_backup.bat

C:
cd C:\Program Files\Veritas\NetBackup\bin
start bpbackup -p Windows-Servers-dbs -s %arg% -L C:\oracle\Dba\logs\CMDB\hot_backup_logs\%arg%_28_Hotback.%newDate%.log -f C:\oracle\Dba\scripts\CMDB\hot_backup_scripts\%arg%list.txt
set var_stop=1

Do 

	sleep 10
	tasklist.exe /fi "IMAGENAME eq bpbackup.exe">C:\oracle\Dba\logs\CMDB\hot_backup_logs\borrame.txt
	tasklist.exe /fi "IMAGENAME eq bpbkar32.exe”>>C:\oracle\Dba\logs\CMDB\hot_backup_logs\borrame.txt
	tasklist.exe /fi "IMAGENAME eq bpcd.exe”>>C:\oracle\Dba\logs\CMDB\hot_backup_logs\borrame.txt
	findstr /i /s "bpbackup.exe bpbkar32.exe bpcd.exe" C:\oracle\Dba\logs\CMDB\hot_backup_logs\borrame.txt
	echo error level is %errorlevel% >>C:\oracle\Dba\logs\CMDB\hot_backup_logs\logfile.txt
	if %errorlevel% equ 0 (echo Todavía está corriendo el envío a Veritas > C:\oracle\Dba\logs\CMDB\hot_backup_logs\Verificacion.log ) 
	if %errorlevel% equ 1 (echo Terminó el envio a Veritas >> C:\oracle\Dba\logs\CMDB\hot_backup_logs\Verificacion.log) & start C:\oracle\Dba\scripts\CMDB\hot_backup_scripts\hot_CMDB_backup_end.bat & Exit Do
Loop

exit;

Open in new window

ASKER CERTIFIED SOLUTION
t0t0

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 30 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 30 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros