task kill
Moderator: DosItHelp
task kill
hi
a request to the genius out there..
I have an application start.exe running. it crashes often and the process needs to be reset with another application restart.exe.
now my request is a script that checks if start.exe and werfault.exe is running at the same time
if so kill start.exe and wait for 5 seconds before calling restart.exe and end..
thanx in advance
a request to the genius out there..
I have an application start.exe running. it crashes often and the process needs to be reset with another application restart.exe.
now my request is a script that checks if start.exe and werfault.exe is running at the same time
if so kill start.exe and wait for 5 seconds before calling restart.exe and end..
thanx in advance
Re: task kill
Try that (untested):
Remove the last two lines if you don't want to observe it permanently.
Steffen
Code: Select all
@echo off &setlocal
:loop
for /f %%i in (
'tasklist /nh /fo csv^|findstr /bi "\"werfault\.exe\" \"start\.exe\""^|find /c /v ""'
) do if %%i geq 2 (
taskkill /f /im "start.exe"
>nul timeout /t 5 /nobreak
start "" "restart.exe"
)
>nul timeout /t 10 /nobreak
goto loop
Steffen
Re: task kill
steffen will test it tomorrow and get back to you
thank you very much for sparing me yr valuable time
highly appreciated..
thank you very much for sparing me yr valuable time
highly appreciated..
Re: task kill
steffen hi
I got the script running but it does something unusual
it restarts the start.exe even if there is some other application crash (ie werfault.exe related to some other application say b.exe)
is there any other way to relate the werfault.exe to start.exe and then do the rest of the processes
please help me out
thanx
joe
I got the script running but it does something unusual
it restarts the start.exe even if there is some other application crash (ie werfault.exe related to some other application say b.exe)
is there any other way to relate the werfault.exe to start.exe and then do the rest of the processes
please help me out
thanx
joe
Re: task kill
I don't know. Try to execute TASKLIST /V in order to see if the status of start.exe is changing.
Steffen
Steffen
Re: task kill
yes tried running tasklist /v
it is not varying it shows start.exe 2376 console session 0 .
it is not varying it shows start.exe 2376 console session 0 .
Re: task kill
It's not that easy for me because "it crashes" is not a description where I could imagine what really happens.
Attached is an executable that outputs four columns.
- process ID
- number of threads the process is running
- number of suspended threads
- process name
If you run it without an argument then it outputs a list of all processes. If you pass a process name then it outputs a list of processes that have the specified process name.
Try to find out what happens if the application "crashes". Are all threads suspended or maybe a certain number of threads? Or does it already "crash" if only one thread is suspended?
Steffen
Attached is an executable that outputs four columns.
- process ID
- number of threads the process is running
- number of suspended threads
- process name
If you run it without an argument then it outputs a list of all processes. If you pass a process name then it outputs a list of processes that have the specified process name.
Try to find out what happens if the application "crashes". Are all threads suspended or maybe a certain number of threads? Or does it already "crash" if only one thread is suspended?
Steffen
- Attachments
-
- threadstatus.zip
- (2.24 KiB) Downloaded 345 times
Re: task kill
hi steffen
sure got your point
let me see what I can gather, may be by tomorrow I can get touch with you
thanx buddy
going to bed its 2130hrs here in india.
gn
sure got your point
let me see what I can gather, may be by tomorrow I can get touch with you
thanx buddy
going to bed its 2130hrs here in india.
gn
Re: task kill
hi steffen
checked the status in tasklist
found this
normal: start.exe pid 5040 threads 2 suspended 0
crashed: start.exe pid 5040 threads 2 suspended 1
this was checked in normal operation and when the app crashed..
can you figure out..
thanx
joe
checked the status in tasklist
found this
normal: start.exe pid 5040 threads 2 suspended 0
crashed: start.exe pid 5040 threads 2 suspended 1
this was checked in normal operation and when the app crashed..
can you figure out..
thanx
joe
Re: task kill
I'm not aware of any command that is able to determine the suspended status of process threads. Just keep using my tool.
In case you're interested in the C source I could provide it.
Steffen
Code: Select all
@echo off &setlocal
:loop
for /f "tokens=1-3" %%i in ('threadstatus "start.exe"') do if %%k neq 0 (
taskkill /f /pid %%i
>nul timeout /t 5 /nobreak
start "" "restart.exe"
)
>nul timeout /t 10 /nobreak
goto loop
Steffen
Re: task kill
steffen
to be very honest I like the way you guys tend to help other who are
non programmer by spending your valuable time.
will try the code with your app tomorrow and get back to you with the final results
thanx buddy once again..
joe
to be very honest I like the way you guys tend to help other who are
non programmer by spending your valuable time.
will try the code with your app tomorrow and get back to you with the final results
thanx buddy once again..
joe
Re: task kill
You're only fighting against symptoms. Let the developers of the software know of your problems. As well as you, they should be interested in a stable application without frequent crashes.
Steffen
Steffen