?
Solved

How to stop running a scheduled batch file?

Posted on 2006-04-26
8
Medium Priority
?
574 Views
Last Modified: 2013-12-28
In Windows Task scheduler a batch file is scheduled to run everyday at 6am. The first day the job ran successfully (which kicked off some other processes) in < one minute. However the second day the status shows "running" persistently and the jobs that supposed to be kicked off by the batch file never got kicked off.

The batch job is scheduled to run every day at 6am. It's now after 12 noon and it is sitll "running". I tried to add an "exit" line at the end but it didn't work. Is there anything that I am missing?

The batch file is as follows:

@ECHO OFF
DEL C:\AT_Batch\at_spool.txt
sqlplus pinprd/pintst_pin05@xm_pintst  @"C:\AT_Batch\at_sql.sql"
exxit

Thanks.
0
Comment
Question by:HKBoyz
8 Comments
 
LVL 7

Assisted Solution

by:MessHallMan
MessHallMan earned 400 total points
ID: 16544963

I would add the word CALL in front of this line: sqlplus pinprd/pintst_pin05@xm_pintst  @"C:\AT_Batch\at_sql.sql" so that a response is returned to the batch file so that it can close out.
0
 

Author Comment

by:HKBoyz
ID: 16545040
I did try that but got the result (ie. status keeps "running" forever).
0
 

Author Comment

by:HKBoyz
ID: 16545270
I mean I got the same result with "CALL".
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 1200 total points
ID: 16551528
Is the SQLPLUS process still running ... check task manager process list and kill it.

Try
CLS
EXIT
at the end of the batch file.
0
 

Author Comment

by:HKBoyz
ID: 16553471
did try both and got the same result. This may not be the problem of the batch file. I have "exit" in the batch file and i could see the dos window pop uo when batch file is being executed. When finished the dos window goes away, but the batch status is still "running".

Would it be the Windows Task Scheduler which keeps the batch file running?
0
 
LVL 4

Assisted Solution

by:rutten-d
rutten-d earned 400 total points
ID: 16565149
perhaps the batchfile stops at the line where the file is deleted because it is asking for confirmation but you cannot see it ;
the first time went ok because the file did not exist (just guessing)
Try adding /Y after the delete command to avoid confirmation dialog
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 1200 total points
ID: 16565318
So is the SQLPLUS process till running or not?  Perhaps Task Scheduler sees that a 'child' process is still running?
What happens when you launch it manually?
0
 

Author Comment

by:HKBoyz
ID: 16577548
Added "Exit" at the end of the SQL file (not the batch file) and it takes care of it. Once the SQL was executed the batch file also stopped running.
Thanks everyone.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
Know the reasons and solutions to move/import EDB to New Exchange Server. Also, find out how to recover an Exchange .edb file and to restore the file back.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question