At work we have bunch of automated scripts running on one of the servers. Most are either batch scripts or PHP scripts that are triggered at various intervals sending out automatic email notifications, or some important business stats to the directors. Few people complained to me that they stopped receiving some of the emails sometime last week.
When I peeked at the Windows Task Scheduler on the server, I noticed that several of the tasks had their status listed as Running. This was obviously an issue, because most of these scripts only require fraction of a second to execute. Furthermore, right clicking affected items and choosing End Task produced absolutely no effect. Something went very wrong here.
I really did not want to reboot the whole machine for a stupid little issue like that so I started poking around trying to find the rogue processes. Unfortunately, the scripts themselves must have finished running long time ago and they did not appear in the task manager. It was not the scripts but the actual scheduler threads that launched them seem to have hung themselves.
Fortunately, I found out that restarting the task scheduler service did the trick. You can actually do this from the Scheduled Tasks window. Simply go to Advanced on your toolbar and choose Stop Using Task Scheduler. Then go back and click Start Using Task Scheduler again. If the window does not refresh automatically, just reload it manually. The status on the hung tasks should clear themselves.
I’m not sure what caused this to happen. I will keep my eye on the server to see if it does it again. It could be a number of things – for example the scripts themselves may be doing something strange. But on the other hand they were working for several weeks now without any issues, so go figure.
[tags]windows, windows task scheduler, task scheduler, scheduled tasks, running tasks, servicesp[/tags]
I recommend using VisualCron. With that automation tool you have perfect control of all running tasks that were started. Also it has some interesting functions like PGP/FTP/FTPS/SFTP.
/ Roy
Thanks! It looks cool. I will definitely check it out.
Thanks for the article! I was looking for a solution to the exact same issue and this was it.
Thanks !
I had the same issue and stopping and starting the task scheduler (as you have mentioned) took care of it.
I doubt it has anything to do with the script itself. I have about 10 of them running in Task Scheduler. They all hung. So, I think it is something to do with Task Scheduler itself.
E~
Simple and brilliant article. Helped me straight away.
Thanks!!
It worked for me.
Another thanks, had run into the same exact issue and fixed it right off with the help from this article.