How to kill a scheduled task? - scheduled-tasks

In Kentico 11 is there any way to kill a running scheduled task that does not affect other running tasks? The Kentico devnet site only mentions restarting IIS or recycling the app pool, which is suboptimal.

Related

How to setup High available active-passive postgresql which has scheduled job running on server

I am new to postgresql, I went through the Postgres documentation which provides details for the active passive server setup.
What I want is the scheduler in spring boot should run only on server which is pointing to active mode, and in passive mode the schedular should not run.
As soon as active goes down and passive takes over as new active, then jobs should start running on new server.
I just have 2 jobs , one runs each 5 mins and one runs everyday at 1AM.
Need help in achieving this

Quartz scheduler stops working after some time in iis

When I publish my application to IIS server, quartz scheduler stop working after some time.In my local machine IIS server it works fine.
I need to perform some functionality every day at 11:55 pm.
By default, IIS recycles an application pool after some inactivity time. I guess this is your problem. The application will be just shutdown if nobody uses it.
While it is possible to make the application pool in IIS to run forever, it is still better to not schedule background tasks using web applications.
Use windows services or just simple Windows Task Scheduler for scheduling.
There are a couple of good solutions for scheduling background tasks with C# in .Net:
Topshelf
Hangfire
Here is a nice topic about using both solutions "Setting up windows service with Topshelf and HangFire"

How to restart service at scheduled time in Marathon?

Is there any way to have a Docker-based service on Marathon restart itself at a given time everyday? What I'd like is a way to say something like "scale to 0 at midnight and scale it to 1 at 6am" or something like that.
On DC/OS there is the notion of jobs but it isn't clear to me whether a job can restart a running service.
As far as I know Marathon has no such feature, Marathon is used to manage(create/delete/scale/health-check) apps on Mesos cluster as what init process(e.g. Systemd) do for Linux. Scheduled jobs is delegated to other frameworks, scheduled jobs functionality on CS/OS mentioned in your question is provided by metronome, and there's also a sophisticated framework Chronos to do the same thing, as what crontab job for Linux.
Even Marathon has no built-in features like that, it provides rich RESTful APIs, you can easily resolve your problem by using Chronos and Marathon together:
Create a script to stop/start your app through Marathon API
Create Chronos job to run your script at midnight to stop your app
Create Chronos job to run your script at 6AM to start app
You can use mesos-chronos for scheduling job.Docker can be scheduled using it.More details at https://mesos.github.io/chronos/

Quartz scheduler not executing job after app pool recycle (.Net)

We have an intranet application hosted on IIS 8.0.
We have some web methods available which needs to be executed at certain time.
So, we have used the Quartz scheduler to schedule the job for executing web methods. In Application_Start event of global.asax, we have written the code to start the scheduler.
To keep the scheduler up and running the Application Pool should be in running mode always, so we have set the property startMode=“AlwaysRunning” and also, application should be started so we have set the application property preloadEnabled=“True”.
We are recycling the application pool at every 1740 minutes (29 Hours, the default time).
Here the question is:
If I have a job scheduled at 3:00 AM in the morning. My app pool is in running state.
I have browsed the application at 6:00 PM on one day before of schedule time.
As per the recycling time my app pool has been recycled at 2:00 AM and till 3:00 AM my application was not pinged but my app pool was in running state.
When Application Pool is recycled, the application pool will be started again (because of the property startMode=“AlwaysRunning”) but the process id if that worker process would be different.
Due to the recycle of app pool quartz had not executed the job as per the schedule. If I browse the application after recycling of app pool, then quartz will execute the job as per the schedule.
Can anyone help me on this at the earliest?
Thanks in anticipation.
If your IIS 8.0 is running on Sever 2012 OS, you will need to turn on 'Application Initialization' feature.
Please visit this link for more information.
Only after the feature in added, the property 'preloadEnabled=“True"' will be effective.
Please let me know if you are facing this issue on any other OS.
Hope this helps.

Setting up deployments with Capistrano, Sidekiq and Monit

My application uses Sidekiq to handle long (several minutes) running background tasks. Deployments are done with Capistrano 2 and all processes are monitored with Monit.
I have used capistrano-sidekiq to manage the sidekiq process during deployments but it has not worked perfectly. Some times during the deployment a new sidekiq process is started but the old one is not killed. I believe this happens because capistrano-sidekiq is not operating through Monit during the deployment.
Second problem is that because my background tasks can take several minutes to complete my deployment should allow two sidekiq processes to co-exisit. The old sidekiq process should be allowed to complete the tasks it is processing and a new sidekiq process should start taking new tasks into processing.
I have been thinking about something like this into my deploy script
When deployment starts:
I tell Monit to unmonitor the sidekiq process
I stop the current sidekiq process and give it 10 minutes to finish its tasks
After the code has been updated:
I start a new sidekiq process and tell Monit to start monitoring it.
I may need to move the sidekiq process pid file into the release directory if the pid file is not removed until the stopped sidekiq process has eventually been killed.
How does this sound? Any caveats spotted?
EDIT:
Found a good thread about this same issue.
http://librelist.com/browser//sidekiq/2014/6/5/rollback-signal-after-usr1/#f6898deccb46801950f40ad22e75471d
Seems reasonable to me. The only possible issue is losing track of the old Sidekiq's PID but you should be able to use ps and grep for "stopping" to find old Sidekiqs.