How to view and remove cron jobs in drupal 7 - drupal

I'm new to drupal 7 and I need to see what cron is running. I had a cron Feeds scheduled to run once a day and it is no longer needed. I deleted the feed but the cron is still running.
Thanks

Drupal has an auto-cron implementation, to disable it go to mysite.com/admin/config/system/cron and set 'Run cron every' to 'Never'.
If that doesn't work check there are no lingering jobs scheduled in your server's crontab.
Hope that helps
EDIT
Just to add, you can't 'see' what jobs are running in Drupal as such because there is only one - the job you can cancel by setting the afore-mentioned setting to 'Never'

Use for this module ultimate_cron
you may read extended log message and control of all cron jobs.

Related

Scheduling hangfire jobs in a different project to where they are executed

I have 2 .net core web projects.
One of them is called ScheduledJobs and it uses Hangfire with the dashboard to both schedule and process jobs.
The other is called ClientWebsite and it schedules the jobs only - but I dont want them executing here!
ScheduledJobs works fine, if I schedule anything from there it picks them up and processes them.
But since I need to be able to schedule jobs from clientWebsite too, I have to have the following settings in startup:
services.AddHangfire(x => x.UseSqlServerStorage(Configuration.GetConnectionString("DefaultConnection"));
services.AddHangfireServer();
If I dont call services.AddHangfireServer it wont even let me schedule them.
But if I add it, then it processes them too which I dont want !
Please help! Thanks
You shouldn't need to register the hangfire service at all in the second project in this way.
If you want to purely queue jobs from it you can use the GlobalConfiguration to set up which database it should point at similar to
GlobalConfiguration.Configuration.UseSqlServerStorage(Configuration.GetConnectionString("DefaultConnection"));
Once you have done this you can register a BackgroundJobClient similar to this (this is taken from an autofac example so depending on your DI it wont be exactly the same as the line below)
builder.RegisterType<BackgroundJobClient>().As<IBackgroundJobClient>();
What this then allows you to do is resolve and enqueue jobs using the IBackgroundJobClient in your application without setting up a hangfire server at all.
In your classes where you want to enqueue jobs from you can then simple resolve an instance of IBackgroundJobClient and make use of the Enqueue method such as
_myClient.Enqueue<MyJobClass>(x => x.APublicMethodOnMyJobClass());
Details on the backgroundjobclient can be found here - BackgroundJobClient

Running a nightly process with Meteor

I'm writing an application using meteor and I need to run a process each night at a certain time. This process will need access to Meteor's Mongo database and would benefit from other Meteor features too.
Is it possible to run a meteor process or task of some sort on a scheduled basis? Or will I need to use a different stack to achieve what I want?
There's a smartpackage called meteor-cron that can help you: https://atmosphere.meteor.com/package/cron.
Additionally if you want to go more manual you can use Meteor.setInterval (docs) to run every hour and if its midnight to run your task.
Keep in mind if you use meteor deploy for meteor's free hosting, if no one visits your site it will go into a 'sleep mode' then wake up when the next user visits it. The user won't notice it but your meteor app won't be running to run these tasks.

several hook_cron for one module, drupal 6

does anybody know is it possible (drupal 6) to create several tasks which should run by crontab? I've created hook mymodule_cron but I need one more. Is it possible to create something like mymodule_another_task_cron?
Thanks
Why don't you add another task in your existing hook_cron? You can call whatever functions you want from one hook_cron.
I can highly recommend the Elysia Cron module
Elysia Cron extends Drupal standard cron, allowing a fine grain control over each task and several ways to add custom cron jobs to your site.
As a module developer the method you'll be most interested in is implementing hook_cronapi() to register jobs that can be scheduled individually through the Elysia cron admin settings.
There's also Ultimate Cron, but I can't vouch for that one as I've never used it.

Drupal Scheduler module cron

I'm using the Scheduler module to publish and unpublish my content at certain times, however I would like to get a more frequent publish than using the Drupal cron itself.
There is an option within the scheduler for using a lightweight cron specifically for scheduler but I have never written a cron task before and I just simply do not know what I am doing, it gives me an example of how I would write one which is
/usr/bin/wget -O - -q "http://example.com/scheduler/cron"
To make sure I am getting this correctly, would this line (modified to point to my address) go into a file called cron.php?
I have tried doing the above but it doesnt appear to be publishing my content
No, you'll need to add this line to your crontab on the server. Talk to your hosting provider, they should be able to help you.
If you're running your own server, run this command from in the shell:
crontab -e
And add your line last in that file.
See here for more info.

Using the scheduler module on Drupal 6 and Cron

I am wanting to use the scheduler module on Drupal 6 which adds some fields to a node edit page to Publish or Unpublish the node on a specific day and time. The problem is the scheduler is dependent on cron running. The part I'm confused on is how could you possibly schedule a node to publish or unpublish at a specific time unless cron was just constantly running? In other words, if I created a piece of content and scheduled for it to get published two days from now at 8 in the morning, unless cron was running at 8 in the morning, the node would not get published correct? So say for example we only have our cron running twice a day say at 2 in the morning and maybe 2 in the afternoon (I'm just throwing out arbitrary times) and we have our scheduler set to publish our article at 8 in the morning, it technically wouldn't get published until 2 in the afternoon when the second cron activity ran correct? We obviously don't want cron running all the time as it probably wouldn't be good for the site. Am I missing something as far as how this stuff works? OR does anyone have a better solution for allowing nodes to get published and unpublished at set dates and times?
Thanks
I am hoping you have Scheduler module in mind to do the task which you have to do. As per the documentation of this module it only publish/unpublished the node when your cron run next to your scheduled timing. This is what has been written over there--
Scheduled automated publish and unpublish functions occur via the cron
system so the actual, real world, publication times will be aligned to
when your cron system runs. For example, if you enter a published time
of 3:45pm but cron only runs once an hour on the hour then the real
publish time will be 4:00pm and not 3:45pm.

Resources