[TSF] Upload Restarting Batch Script

  • Thread starter Deleted member 46272
  • Start date
Status
Not open for further replies.
D

Deleted member 46272

Guest
Hi Guys!
I've been using this script to run the DF upload process. It restarts if the link with the server was dropped, and STOPS when the process finishes (unlike the infinite loop scripts I see floating around), making it a set-it-and-forget-it affair.

It's only been tested on WIN98, but should work for Win2k and XP. It's generic code, nothing fancy.

If you want to stop uploading, delete the "upload.lock" file in the directory. The BAT checks for it every time it restarts the upload process. If you just kill the BAT, you can end up losing your error.log file.

The "if [%E2%]==[] set E2=0. . . . ." (first 30 or so lines) at the beginning is just for the counter. Don't delete it!

I will NOT be providing support for this, other than introduce improvents, debug, and possibly increase functionality if they are pointed out/suggested. If you don't know how to use a batch script, please move on. Sorry, I'm limited on time.

Code:
@echo off

IF EXIST error.log REN error.log error.log.old

:restart


:: *************************
::          COUNTER
:: *************************

:: Increments a three digit number
:: Works by comparing each digit
:: E2=hundreds, E1=tens, E0=ones

if [%E2%]==[] set E2=0
if [%E1%]==[] set E1=0
if [%E0%]==[] set E0=0
:E0
if %E0%==9 goto E1
if %E0%==8 set E0=9
if %E0%==7 set E0=8
if %E0%==6 set E0=7
if %E0%==5 set E0=6
if %E0%==4 set E0=5
if %E0%==3 set E0=4
if %E0%==2 set E0=3
if %E0%==1 set E0=2
if %E0%==0 set E0=1
goto DONE
:E1
set E0=0
if %E1%==9 goto E2
if %E1%==8 set E1=9
if %E1%==7 set E1=8
if %E1%==6 set E1=7
if %E1%==5 set E1=6
if %E1%==4 set E1=5
if %E1%==3 set E1=4
if %E1%==2 set E1=3
if %E1%==1 set E1=2
if %E1%==0 set E1=1
goto DONE
:E2
set E1=0
if %E2%==9 set E2=0
if %E2%==8 set E2=9
if %E2%==7 set E2=8
if %E2%==6 set E2=7
if %E2%==5 set E2=6
if %E2%==4 set E2=5
if %E2%==3 set E2=4
if %E2%==2 set E2=3
if %E2%==1 set E2=2
if %E2%==0 set E2=1
goto DONE
:DONE

:: *************************
::       COUNTER END
:: *************************


	ECHO ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	ECHO Starting Upload (Attempt: %E2%%E1%%E0%)
	echo Upload lock file > upload.lock
	START /w /m foldtrajlite -f protein -n native -df -u t 
	
	FIND /C "NO RESPONSE FROM SERVER" error.log > nul
	:: FIND returns an errorlevel of 1 or higher if the search string WASN'T found.
	IF ERRORLEVEL 1 GOTO finished
	IF NOT EXIST Upload.lock GOTO quit

	copy error.log.old+error.log error.log.tmp > nul
	del error.log.old
	del error.log 
	ren error.log.tmp error.log.old
	
	GOTO restart

:finished

	echo Upload finished !!!
	GOTO end

:quit
	echo Lock file not found, quitting . . . 
	GOTO end

:end
	IF EXIST Upload.lock DEL Upload.lock
	@copy error.log.old+error.log error.log.tmp
	del error.log.old
	del error.log 
	ren error.log.tmp error.log

	@echo off
	cls
 
D

Deleted member 46272

Guest
Hmm - looks like under XP you need to change

Code:
START /w /m foldtrajlite -f protein -n native -df -u t

to

Code:
START /w foldtrajlite -f protein -n native -df -u t

i.e. get rid of the "/m".

Also, the ECHO commands seem to be a bit screwed up - i.e. different form win98, but otherwise it runs fine. Get ride of the

Code:
 ECHO ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

line, and it will even look OK.
 
Status
Not open for further replies.