rem ***** DAILY BACKUP PROGRAM  ***********************************************
@echo off
rem ***** test for aspi manager, load it if not present ***********************
loadaspi -s
if errorlevel 10 if not errorlevel 12 goto loadfe
loadaspi c:\bin\aspi2dos.sys
if not errorlevel 1  goto loadfe
@echo ##### LOADASPI failed to install the ASPI Manager #####
goto fatal
rem ***** test for datman file engine, load it if not present *****************
:loadfe
datmanfe -s
if errorlevel 12 if not errorlevel 13 goto mount
datmanfe -x2048 -nMY_STATION -vh
if not errorlevel 1 goto mount
if errorlevel 24 if not errorlevel 25 @echo ##### No DAT (or No Power) #####
@echo ##### DATMANFE failed to install the File Engine #####
goto fatal
rem ***** force a new mount and test for read/write operation *****************
:mount
datman dmount
datman -q dstatus
if not errorlevel 1 goto sleep
if errorlevel 1 if not errorlevel 2 @echo ##### Tape in Read-Only mode #####
if errorlevel 2 if not errorlevel 3 @echo ##### Tape Write-Protect Tab #####
@echo ##### Tape Not Ready for Write Operation #####
goto fatal
rem ***** enter idle mode *****************************************************
:sleep
wakeup  1:00am
if not errorlevel 1 goto backup
@echo Do you wish to end the Daily Backup batch program? (Ctrl-Break to end)
pause
rem ***** backup operation starts here ****************************************
:backup
dcopy c:\ t:\drive_c    /h/i/c/e/y/bi/j0/x~*.tmp/xwin386.swp/oc:\budailyc.log
dcopy f:\ t:\drive_f /hb/h/i/c/e/y/bi/j0/x~*.tmp            /oc:\budailyf.log
dflush
datmanfe  -u
loadaspi  -u
dir c:\budaily?.log
@echo !!!!! Daily backup complete !!!!!
goto end
rem ***** fatal case **********************************************************
:fatal
@echo.
@echo ##### Fatal error, batch file terminated. #####
goto end
:end
wakeup never
