I running a console application via Windows Task Scheduler but it is taking more time while running it? - scheduled-tasks

I am facing an issue but I couldnt able to find out the root cause of this. First of all sorry I am not clear on this.
I have an application which do call some scripts and gets the sql data from one server and add it to another server. While running it will take around 50 minutes to complete.
But when I call this application via windows task scheduler. Its running for half n hour as expected and for some reason the application is been hanged or paused (not sure what is happening) for 7 hours and after that its getting resumed and takes another 20 minutes to complete. Is there any possibility of the windows task scheduler being paused for 7 hours and resuming back? Like due to log off or any other way?
Below are the settings that is used.
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>P3D</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
Thanks in Advance

Sounds like a virus, user config issue, or version issue. If possible, I would move the app to a different box, window version different and try again. Your new friend is Task Manager, for which you will need admin rights on most versions of windows. Find task manager under control panel. more info: on Microsoft site, keywords "task schedule", "thread priority". A more elaborate solution is to build your own baby task scheduler as a service. Said service to simply invoke you app based on current date time. An even simpler solution is to create a tiny ALWAYS RUNNING app that invokes you present app whenever by whatever rule(s) you code. [i.e. skip learning about sevices, configuring task scheduler, etc ]

Related

Irregular Trigger BizTalk Scheduled Task Adapter

I have several receive locations of type schedule in a BizTalk 2016 server. All except one work fine. This one has been getting triggered as defined in the schedule daily at 04:00 am, however it suddenly began to start at 05:00 pm and one day it didnĀ“t run.
There is no Error Log in the Application Logs or the SQL Logs. The Receive Location is enabled. The Server Time is correct.
Does anyone has a hint, what this behavior might be caused by?
BTS 2016
Scheduled Task Adapter 6.0.0.6
The current version is 7.0.2. and that includes some fixes
e.g.
In certain cases task won't trigger in set time with Timespan with Biztalk 2016
Timly Schedule Start Time (and Date) doest not work correct
So I would suggest downloading and installing 7.0.2.
I experienced a similar behavior when the Host Instance is shared and sometimes overloaded. Try to dedicate a HI for scheduling only. And as suggested by #Dijkgraaf, you can use the last version of this Adapter

How to restart an exe when it is exits in windows 10?

I have a process in windows which i am running in startup. Now i need to make it if somehow that process get killed or stopped i need to restart it again in Windows 10?
Is there any way. Process is a HTTP server which if somehow stopped in windows i need to restart it. I have tried of writing a power-shell in which I'll check task-list status of process and then if not found I'll restart but that is not a good way. Please suggest some good way to do it.
I have a golang exe; under a particular scenario my process got killed or stopped i need to start it up again automatically. This has to be done imediately after the exe got killed. What is the best way to achieve this?
I will give you a brief rundown. You can enable Audit Process Termination in local group policy of the machine as shown below. In your case, success audits would be enough. Please note that the pic is for Windows 7. It may change with OS.
Now every time a process gets terminated, a success event will be generated and written to the security eventlog.
This will allow you to create a task scheduler that triggers on the generation of this event that calls a script that would run the process again. Simple right?
Well, you might have some trouble setting that task up especially when you want to pass details about the generating event to the script. This should help you get through that.
You can user Task scheduler for this purpose. There is a option of "restart on failure" which can be selected and whenever your process get failed it will restart again.
Reference :- https://social.technet.microsoft.com/Forums/windowsserver/en-US/4545361c-cc1f-4505-a0a1-c2dcc094109a/restarting-scheduled-task-that-has-failed?forum=winserverManagement

Do not send emails to subscribers in the Reporting Configuration. Kentico 9

After creating a subscription in the Reporting Configuration, the emails are not sent at the specified time, but if you perform any actions on the site, the emails will be sent. This is the problem of the virtual machine on which the site or IIS is deployed. Or does the feature Kentico.
Prompt in what there can be a problem and how the system of sending of emails inin the Reporting Configuration works.
This is a correct behavior. Kentico checks for e-mails that are to be sent at the end of requests which means that if there are no requests, no e-mails are sent. If you need some tasks to be send at a specified time, you need to use Windows scheduler and configure task (e-mmail sending) to use it. See official documentation for more detail.s
Another option to Enn's, is to use a service like UpTime Robot to continually visit your page (like every 5 minutes), this not only generates a request but also will help keep your site awake and from going to sleep if you can't manually set the Worker Processor to never go to sleep.
Windows Scheduler is the most reliable, but UpTime robot has worked well for us.
https://uptimerobot.com/
Under the "Scheduled Tasks" module there is a schedule task called "Report subscription sender". This task runs every minute and is responsible for checking your subscriptions and sending e-mails based on your configuration. This task runs within the Kentico instance. By default IIS will put the site/app pool to sleep after x (default 20) minutes of idle and the scheduled tasks are no longer able to run. When you hit the site it wakes the process back up and the scheduled task is able to run again. You can go into IIS and configure the "Idle Time-out (minutes)" for the application pool see this link https://patrickdesjardins.com/blog/iis-no-sleep-idle-and-autostart-with-values for a pretty good illustration. You can also adjust the app pool recycle intervals but that is probably not necessary for your issue.
The other option, as mentioned by Enn, is to install the Kentico Scheduler Windows service which always runs and configure that scheduled task to run in the service.

Windows Service "Starting"

I have a critical windows service that I need for my web application.
Unfortunately, the windows service does not start properly, but remains in a status of "Starting" for about 7 minutes and 38 seconds, and then fails.
My web application works fine when the service is in the "Starting" mode.
I have a windows scheduled task that runs every minute to restart the service if necessary.
net start "my service"
Therefore there is a gap of about 22 seconds from when the service fails until it starts up again. In additional it takes an additional 30 seconds or so for my application (which is dependent on this service) to start working.
I have intentionally not named the errant service. I did open a separate question https://stackoverflow.com/questions/8470975/oracle-oc4j-service-keeps-stopping whose aim was to actually solve the problem.
In this question, I am not trying to solve the problem, but rather find a workaround to try and keep this service in a status of "Starting" the whole time.
What is infuriating, is that until I restarted the server today, my workaround of restarting the service every 3 minutes actually worked, with no application downtime whatsoever.
Does anybody have any suggestions? I did try changing the registry key of ServicesPipeTimeout to 86400000 (24 hours!) in a bid to keep the service in the status of "Starting" for longer.
I have found a possible solution to my problem that I am very uneasy about...
I downloaded WinDbg from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=8279
I opened WinDbg and did Attach to Process, and selected my service.
As long as WinDbg is open, it seems to "hold" the process and prevent it from stopping.
How long it will continue to do so, remains to be seen, but it has held for over half an hour now (whereas before the service stopped after 8 minutes)
If you have the timeout set to 24 hours and the service does not start or stay in 'starting' mode , then it must be either crashing or closing itself down.
If you want to try to restarting your service immediately it crashes, then, on the properties of your service, select the 'Recovery' tab. You should be able to set the service to restart on first, second and subsequent failures and set the service to restart after 0 minutes,
Note, this will not work if windows thinks that the service is closing down properly.
It should go without saying that this is a last resort only if you can't get whoever wrote the service to fix the problems.
Try specifying 'Restart the Service' for all three sections on the Recovery tab, but that will only work if the service is ending abnormally.
Our company faced a similar problem and we developed Service Protector, a commercial application that can babysit a service and keep it running 24/7. It may work in your situation too.

Fiddler - Daily stop start

What is the best way to stop/start Fiddler as a daily task?
I am usin Fiddler to monitor/logs https trafficon machine which runs fully automated and runs software which is not controlled by me, but uses https.
My machine stopped yesterday because Fiddler went out of memory after running over 3 days and now I want to have a clean way to start/stop it.
I guess I could just specify a process duration in the task manager, but I would prefer something cleaner, especially to avoid issues when things are started manually.
Just use Scheduled Tasks, they have been part of windows since forever. You should be able to stop fiddler with it too (by calling TaskKill).