How to stop running a scheduled batch file?

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.
HKBoyzAsked:
Who is Participating?
 
Steve KnightIT ConsultancyCommented:
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
 
MessHallManCommented:

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
 
HKBoyzAuthor Commented:
I did try that but got the result (ie. status keeps "running" forever).
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
HKBoyzAuthor Commented:
I mean I got the same result with "CALL".
0
 
Steve KnightIT ConsultancyCommented:
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
 
HKBoyzAuthor Commented:
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
 
rutten-dCommented:
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
 
HKBoyzAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.