Computing.Net > Forums > Disk Operating System > Restart capability by reading a log

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Restart capability by reading a log

Reply to Message Icon

Name: Aftab Khan
Date: June 10, 2003 at 12:38:08 Pacific
OS: WinNT
CPU/Ram: 32
Comment:

Hi!
I really appreciate if some one can help me on this. Thanks much!
I got a bat (Job.bat) file that executes several commands (like: 1. Copy, 2. Delete a file, 3. Again Copy and 4. Move a file) as follows:

:label1
copy file1 file2
:label2
del file1
:label3
copy file2 file3
:label4
move file3 /otherplace/file3
What I want to have a log file that will keep track of waht job I am performing that is the label name after a successful job. Say job3 fialed, and when I want to restart the entire job the log file is read and since it finds an entry for Job2, I want to start /restart the entire process from job3 only and not starting from job1.

Can this be done in an easy way? Thanks again!



Sponsored Link
Ads by Google

Response Number 1
Name: Secret_Doom
Date: June 10, 2003 at 14:46:06 Pacific
Reply:

Let me see if I understood it right... If the process on label2 is unsuccessful, you want the batch file to exit and when it is run again, you want it to jump strigt to label2 again. Right?

If so, I believe the following will do:

@echo off
set label=
if exist log.bat call log.bat
if not "%label%"=="" goto %label%

:label1
echo set label=label1> log.bat
copy file1 file2
if errorlevel=1 goto exit

:label2
echo set label=label2> log.bat
del file1
if errorlevel=1 goto exit

:label3
echo set label=label3> log.bat
copy file2 file3
if errorlevel=1 goto exit

:label4
echo set label=label4> log.bat
move file3 /otherplace/file3
if errorlevel=1 goto exit
echo set label=label1> log.bat

:exit

The log file extention (in this sample, log.bat) must be .bat. This sample assumes the commands will return errorlevels greater than 0 if an error occurs.

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br


0

Response Number 2
Name: Aftab Khan
Date: June 11, 2003 at 06:26:19 Pacific
Reply:

Hi there!
Good to hear from you again! You are my hero! Thanks again buddy! How is every thing? Keep in touch! Bye now!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Restart capability by reading a log

How to create a log file in 1 line www.computing.net/answers/dos/how-to-create-a-log-file-in-1-line/12735.html

creating a log file www.computing.net/answers/dos/creating-a-log-file/13088.html

Creating a log file to keep files name www.computing.net/answers/dos/creating-a-log-file-to-keep-files-name/17043.html