• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

batch file help

aluminex

Junior Member
I have created a batch file to do a backup of data for 60+ remote servers.
I need a way that some type of log or file can be generated and pushed remotely if there is any errors at the time of batch execution.

i.e.
Batch file runs.
Starts backing up but the network goes down and it doesnt complete.

I need a batch file to run and let me know if it finishes...

Any ideas on how to do this is much appreciated
 
I know you could do this with a unix bash script, but I'm not sure about windows batch... personally I would use a more powerful language.

This post also serves as a bump.
 
Have the batch file generate a log file.
Then mail the logfile to you.
 
Is your batch file actually interacting with any sort of backup software? Most backup software programs allow you to associate batch files with the completion of a job. It would be relatively easy to then parse which ones completed and which ones failed.

Otherwise, the only possibility is to have the batch file monitor whatever process you kicked off, but then you have no idea whether it completed successfully or failed, only when it completed.
 
The batch file isnt working with any type of backup software. It is only copying x directory to x directory on another pc over the network.
I can generate a log file but it doesnt tell me if it failed or succeceded
 
if you run your copies in sequence and do not kick off any seperate processes, you can use %errorlevel% to report whether they failed or not. A 0 means success and anything greater means a failure. %errorlevel% is set at the end of a command, such as your copy job. So have the batch file run a copy and then immediatly output the errorlevel afterwards. Ie with an echo that states "copy such and such, completed at %time% with errorlevel %errorlevel%"
 

This is my current batch file.
Do I add the errorlevel after each copy and xcopy command?

@echo off
cls
echo *************************************************************************************
echo *
echo * BACKUP !!!!
echo *
echo *
echo *************************************************************************************

time /t
echo * please wait approximately 10 minutes while v18.4 is backed up...

:VERRXBACKUP
c:
IF exist \rxbackup1\. goto COPYRXBACKUP

:MAKERXBACKUP
c:
md \rxbackup1
md \rxbackup1\crx
md \rxbackup1\qs1
md \rxbackup1\runner

:COPYRXBACKUP
cd \rxbackup1

xcopy \crx \rxbackup1\qs1 /s /y
xcopy \qs1 \rxbackup1\qs1 /s /y
xcopy \runner \rxbackup1\runner /s /y
copy \windows\system32\crx3.dll \rxbackup1\crx3.dll /y
copy \windows\system32\crxrun.dll \rxbackup1\crxrun.dll /y
copy \windows\system32\qcrxrun.dll \rxbackup1\qcrxrun.dll /y

:MAPDRIVE /PERSISTANT:NO
net use b: \\qs1bat\c$

:VERRXBACKUPNET
b:
IF exist b:\rxbackup1\. goto NETCOPY

:MAKERXBACKUPNET
b:
md \rxbackup1
md \rxbackup1\crx
md \rxbackup1\qs1
md \rxbackup1\runner



:NETCOPY

xcopy c:\crx b:\rxbackup1\crx /s /y
xcopy c:\qs1 b:\rxbackup1\qs1 /s /y
xcopy c:\runner b:\rxbackup1\runner /s /y
copy c:\windows\system32\crx3.dll b:\rxbackup1\crx3.dll /y
copy c:\windows\system32\crxrun.dll b:\rxbackup1\crxrun.dll /y
copy c:\windows\system32\qcrxrun.dll b:\rxbackup1\qcrxrun.dll /y

😀ONE
echo.
echo.
echo %computername% %date% %time% File copy operation complete. >> \\k-2ub51102nw\c$\rxlog\log.xls
time /t
echo ...backup of QS1 v18.5 completed
pause
 
Back
Top