Terminating Hung Scheduled Tasks

K

Ken Levy

We are having a problem with an FTP which is running out of a .bat file that
is executed as a Windows Schedule Task that gets hung up. We believe the
hang is due to a broken TCP/IP session that the FTP client doesn't
recognize.

When these tasks hang, the scheduler for this FTP will hang as well, as the
DOS box the batch file runs in never gets closed out.

We've tried setting the scheduler's "Schedule Task Completed - Stop the task
if it runs for: ...." to timeout after two minutes, but it never shuts down
the hung task.

Does anyone have any ideas on how to flush these hung tasks (at least until
I find an FTP client with better error recovery)?

Thanks in advance for any help. Please post any responses to the news
group.

Ken
 
P

Pegasus \(MVP\)

Ken Levy said:
We are having a problem with an FTP which is running out of a .bat file that
is executed as a Windows Schedule Task that gets hung up. We believe the
hang is due to a broken TCP/IP session that the FTP client doesn't
recognize.

When these tasks hang, the scheduler for this FTP will hang as well, as the
DOS box the batch file runs in never gets closed out.

We've tried setting the scheduler's "Schedule Task Completed - Stop the task
if it runs for: ...." to timeout after two minutes, but it never shuts down
the hung task.

Does anyone have any ideas on how to flush these hung tasks (at least until
I find an FTP client with better error recovery)?

Thanks in advance for any help. Please post any responses to the news
group.

Ken

Run kill.exe (Windows Resource Kit) or pskill.exe (www.sysinternals.com):

kill [-f] ftp.exe
 
K

Ken Levy

Thanks for the response, but not quite what I need. I can terminate the
DOS box (and the FTP it is running) manually without any problems (i.e., it
is not a tight hang that needs the kill command). The problem is that this
scheduled task runs 24x7 and we only have people on site 9x5. I can
tolerate a single FTP that fails (we'll catch the files next time the task
runs), but the problem is that when we see this hang, the FTP task doesn't
terminate normally and the DOS box remains up. The task scheduler won't
start any new tasks until we manually terminate the hung FTP script by
closing the DOS box.

What I'd really love is a root-cause solution (i.e., the FTP task recognizes
the broken session and cleans up after itself with an error message instead
of hanging in limbo). Alternatively, I'd like the task scheduler to
recognize that the task has been running too long and flush it after the
timeout in the "Stop the task if it runs . . ." parameter of the job. The
key is I need the recovery to run automatically and not require human
intervention if a hang occurs.



Pegasus (MVP) said:
Ken Levy said:
We are having a problem with an FTP which is running out of a .bat file that
is executed as a Windows Schedule Task that gets hung up. We believe
the
hang is due to a broken TCP/IP session that the FTP client doesn't
recognize.

When these tasks hang, the scheduler for this FTP will hang as well, as the
DOS box the batch file runs in never gets closed out.

We've tried setting the scheduler's "Schedule Task Completed - Stop the task
if it runs for: ...." to timeout after two minutes, but it never shuts down
the hung task.

Does anyone have any ideas on how to flush these hung tasks (at least until
I find an FTP client with better error recovery)?

Thanks in advance for any help. Please post any responses to the news
group.

Ken

Run kill.exe (Windows Resource Kit) or pskill.exe (www.sysinternals.com):

kill [-f] ftp.exe
 
P

Pegasus \(MVP\)

You should probably start a new thread under a different heading
if you're looking for an FTP solution that auto-detects a hung
file transfer.

On the other hand, if you wish to terminate a scheduled task
after a given time then you could schedule this batch file:

@echo off
start /b "" "c:\tools\FTP Batchfile.bat"
ping localhost -n 300 > nul
c:\tools\tlist | find /i "ftp" && kill ftp

This batch file will run two separate threads. One is the FTP
transfer, the other a wait loop. After about 300 seconds,
the wait loop kills ftp if it still active.


Ken Levy said:
Thanks for the response, but not quite what I need. I can terminate the
DOS box (and the FTP it is running) manually without any problems (i.e., it
is not a tight hang that needs the kill command). The problem is that this
scheduled task runs 24x7 and we only have people on site 9x5. I can
tolerate a single FTP that fails (we'll catch the files next time the task
runs), but the problem is that when we see this hang, the FTP task doesn't
terminate normally and the DOS box remains up. The task scheduler won't
start any new tasks until we manually terminate the hung FTP script by
closing the DOS box.

What I'd really love is a root-cause solution (i.e., the FTP task recognizes
the broken session and cleans up after itself with an error message instead
of hanging in limbo). Alternatively, I'd like the task scheduler to
recognize that the task has been running too long and flush it after the
timeout in the "Stop the task if it runs . . ." parameter of the job. The
key is I need the recovery to run automatically and not require human
intervention if a hang occurs.



Pegasus (MVP) said:
Ken Levy said:
We are having a problem with an FTP which is running out of a .bat file that
is executed as a Windows Schedule Task that gets hung up. We believe
the
hang is due to a broken TCP/IP session that the FTP client doesn't
recognize.

When these tasks hang, the scheduler for this FTP will hang as well, as the
DOS box the batch file runs in never gets closed out.

We've tried setting the scheduler's "Schedule Task Completed - Stop the task
if it runs for: ...." to timeout after two minutes, but it never shuts down
the hung task.

Does anyone have any ideas on how to flush these hung tasks (at least until
I find an FTP client with better error recovery)?

Thanks in advance for any help. Please post any responses to the news
group.

Ken

Run kill.exe (Windows Resource Kit) or pskill.exe (www.sysinternals.com):

kill [-f] ftp.exe
 

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