Here in the office we have a bat file which runs every 5 minutes. This bat file ftp's to a remote location, grabs a couple of files and then inputs the contents of those files into a database.
We are having a problem lately whereby the CMD prompt which the bat file opens does not close. It just hangs there on the screen blank. As a result of that the scheduled task which is supposed to run every 5 mins does not run.
This doesnt happen every time but does happen frequently which means I get phone calls/emails wondering whats going on.
What I want to find out is how to makle sure that if the prompt hangs on the screen I have some way of killing it automatically. Whether that is some other sort of scheduled task that searches for it and kills it if it sees it or what I dont know,
All suggestions are apreciated and a rough copy of the bat file is below
echo Starting Import > Import.log
FTP -s:ftp.txt >> Import.log
ren *.csv *.process
for /f %%a in ('dir /b *.process') do sqlldr userid=username@database log=loader.log data="%%a" control=loader.ctl
sqlplus -s username@firstname.lastname@example.org >> Import.log
ren *.process *.complete
del /Q *.complete
echo Import Complete >> Import.log