How to Kick off detached process

J

John Lee

Hi,

I developed a scheduler as service and kick off another console application
"DTSRUN.exe" to run a dts package

ProcessStartInfo psInfo = new ProcessStartInfo(command);
Process process = Process.Start(psInfo);

I have two questions need your help:

1. When I stop my scheduler service, if the dtsrun.exe are still running,
the process will be terminated, how could I kick off a detached process that
will run dtsrun.exe in different process and will not be terminated even the
launching process is terminated?

2. Another strange issue we have here is when the dtsrun.exe is launched,
the following command will be started:
DTSRUN.EXE /S DBServerName /E /W True /N DTSPackageName /A
FileName:8=FileTobeProcessed.txt

This works fine for small files but the DTSPackage hangs there around 28600
records if the filetobeprocessed.txt contains lots of data and the problem
is consistent and reproduceable; Even stranger thing is if I manually issue
the above dtsrun.exe command and it works fine; it seems only if that
command is issued from my service (running under a domain service account
with full permission to database server) with big files will will this
problem - hanging there never finish...

Could anyone shed some light on this?

Thanks very much!
John
 
S

Steven Cheng[MSFT]

Hi John,

Thanks for posting here.
As for the problem you mentioned, is it occur only with the DTSRUN.EXE you
mentioned? Does it also occur if we use another simple console application.
Also, as for the hanging problem, it is likely caused by application
specific issue, what's the detailed code logic in the Console app?

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
J

John Lee

Thanks Steven,

The Service simply use Process.Start to start a process
DTSRUN.EXE /S DBServerName /E /W True /N DTSPackageName /A
FileName:8=FileTobeProcessed.txt

As I mentioned before, if I ran this from cmd shell interactively, it works
fine
and if the service start the above command using Process.Start then it hangs
on large file only!!!
The even strange thing is when I deployed to another environment, it hangs
at the same place - that means after 28866 records processed

Event Type: Information
Event Source: CLC.FileWatcher
Event Category: None
Event ID: 0
Date: 5/24/2005
Time: 11:56:32 PM
User: N/A
Computer: CLC-MSG-IP1
Description:
RunShellCommand: DTSRUN.EXE /S JUPITER /E /W True /N CCCProcessScrubResult
/A FileName:8=\\clc-msgcl-ip1\data\DNC\cccscrub\incoming\clean.txt
WaitForExit: True
ReturnCode: 1
Output:DTSRun: Loading...

DTSRun: Executing...

DTSRun OnStart: DTSStep_DTSActiveScriptTask_1

DTSRun OnFinish: DTSStep_DTSActiveScriptTask_1

DTSRun OnStart: DTSStep_DTSExecuteSQLTask_1

DTSRun OnFinish: DTSStep_DTSExecuteSQLTask_1

DTSRun OnStart: DTSStep_DTSDataPumpTask_1

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 1000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 1000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 2000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 2000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 3000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 3000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 4000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 4000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 5000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 5000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 6000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 6000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 7000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 7000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 8000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 8000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 9000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 9000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 10000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 10000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 11000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 11000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 12000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 12000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 13000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 13000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 14000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 14000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 15000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 15000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 16000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 16000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 17000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 17000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 18000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 18000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 19000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 19000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 20000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 20000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 21000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 21000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 22000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 22000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 23000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 23000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 24000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 24000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 25000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 25000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 26000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 26000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 27000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 27000

DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 28000 Rows have been
transformed or copied.; PercentComplete = 0; ProgressCount = 2
 
J

John Lee

OK, I might found the difference and still do not understand why

Why I change UseShellExecute = true it seems work fine now ... I will be
waiting for tomorrow's big data files to verify it.

hmm ... what is the difference between use shell excute and not to use shell
internally?

Thanks!
 
K

Kevin Yu [MSFT]

Hi John,

When you use the operating system shell to start processes, you are able to
start any document (which is any registered file type associated with an
executable that has a default open action) and perform operations on the
file, such as printing, with the Process component, just as you click on a
file in the explorer. When UseShellExecute is false, you are able to start
only executables with the Process component.

Also, UseShellExecute must be true if you set ErrorDialog to true.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top