Hey,
i wrote an .Net-Assemlby which dynamicly generates a bcs-script from an database ....
After this it starts BC2.exe @xxx.bcs.
This runs every day and copys many files on about 50 servers ... and it works great.
But how can i obtain if one of the scripts get an error.
I start bc2.exe like ...
(VB.Net)
Dim argPSI As New ProcessStartInfo
argPSI.FileName = BCPath
argPSI.UseShellExecute = False
argPSI.Arguments = "@" & Environment.CurrentDirectory & "\" & BCScript & " " & TargetHost & " " & TargetPath & " " & Format(Now, "yyyy-MM-dd").ToString
Dim objProcess As New Process
objProcess.StartInfo = argPSI
objProcess.EnableRaisingEvents = True
AddHandler objProcess.Exited, AddressOf OnProcessExit
objProcess.Start()
RaiseEvent BCInstanceStarted(objProcess.Id, TargetHost)
This works and i get a event if the BC2-Process exits. But exitcode of BC2.exe everytime is 0.
The exitcode also is 0 if BC2.exe get an error and stops abnormally (if i kill the process e.g.).
Thanks
LordMM
i wrote an .Net-Assemlby which dynamicly generates a bcs-script from an database ....
After this it starts BC2.exe @xxx.bcs.
This runs every day and copys many files on about 50 servers ... and it works great.
But how can i obtain if one of the scripts get an error.
I start bc2.exe like ...
(VB.Net)
Dim argPSI As New ProcessStartInfo
argPSI.FileName = BCPath
argPSI.UseShellExecute = False
argPSI.Arguments = "@" & Environment.CurrentDirectory & "\" & BCScript & " " & TargetHost & " " & TargetPath & " " & Format(Now, "yyyy-MM-dd").ToString
Dim objProcess As New Process
objProcess.StartInfo = argPSI
objProcess.EnableRaisingEvents = True
AddHandler objProcess.Exited, AddressOf OnProcessExit
objProcess.Start()
RaiseEvent BCInstanceStarted(objProcess.Id, TargetHost)
This works and i get a event if the BC2-Process exits. But exitcode of BC2.exe everytime is 0.
The exitcode also is 0 if BC2.exe get an error and stops abnormally (if i kill the process e.g.).
Thanks
LordMM
Comment