Hi,
I have a console app that will take an argument to perform many different business process
such as ftp, backup, http request...etc.
I have schedule to run those
job in command prompt such as:
Master_jb.exe ftp
Master_jb.exe backup
Master_jb.exe http_get
If two jobs ran on the same time, I will see the
process in the windows task manager
show two master_jb.exe.
My question is that is there anyway I can
identity which job ran on what parameter? Or is there anyway in C# code
that I can alter the process name that show in the task manager?
Thanks
in advance!
Rich
Loading
Jaish MathewsPosted Apr 28, 2010, 1:12 AM
You can set this in the project's properties page. Setting the assembly name on the application tab will set the name of the resulting compiled assembly. But if you are using same "Master_jb.exe" for all job, it need to rename like Master_jb_ftp.exe,Master_jb_backup.exe,Master_jb_http.exe etc... Then procvess name will get like as.
Jaish MathewsPosted Apr 30, 2010, 12:55 AM
richPosted Apr 29, 2010, 11:53 PM
when my console application start, I will log the process ID in the log using below code:
public static int getProcessID()
{
Process thisProc = Process.GetCurrentProcess();
return thisProc.Id;
}
so now I know my process ID for this particular argument and if somehow this process hung. I can add the PID in windows task manager (view->select columns->PID)
Then I will be able to see the PID like below and kill the exact process.
Master_jb.exe 111
Master_jb.exe 112
richPosted Apr 28, 2010, 4:30 PM
Anyone else can help?
The main concern I have is that if I have many scheduled job running on my application with different parameters.
The windows task manager is going to show many process named: Master_jb.exe
And if one process hung, I will kill the process without knowing which parameters was giving issue.
Kind like if you have many IE open and when one IE hung, you kill the process but do not know which browser is having issue.
richPosted Apr 28, 2010, 10:59 AM
Hi,
Thanks for the response.
I can change the assembly name in property but then it will still be a static name in the windows task manager process because I will still use command line argument to control the process.
And if I rename it for each argument I will have to do that for hundreds of arguments which is not very efficient. Is there any way to dynamically change the assembly name or append something based on argument?
Thanks,
Rich