drupal - schedule a script to run at specific time - drupal

Totally new to drupal.
I'm building a module that lets the user specifies the time to run an external script through a form. I imagine I'd need to play with hook_cron ? but from what I understand, it only runs when the cron is set up to run. So how do I tell Drupal to run the job at this time and that time,etc, everytime the user submits the form?
For example, the form would look like:
Start: 10:00 am
End: 11:00 am
<Submit>
So when the user submits, Drupal will first run the script (defined in my module) at 10 am then again at 11 am.
What module/hook do I need?

Configure your Drupal site to run its cron every 1 minute. Then implement a hook_cron in your module and inside this function loop through the different jobs added through the form and run them at the given time points entered through the form.

Related

How do you set up a cron job that presses the play music button?

On a mac, the f8/play/pause key allows you to play/pause music from itunes/spotify/etc. How do you set up a cron job that presses that play music button every hour of everyday?
you probably want to create a new script in the mac automator application, which is capable of starting music. Then create a run to run that script.
update:
you probably want to use the method (http://www.macworld.com/article/1050616/automatoralarm.html) list on that site to create the automator script. And then it will be case of creating a simple cron to start at the time you.

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.

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.

How to view and remove cron jobs in drupal 7

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.

Resources