Allow setting scheduled time similar to cron job

radman16 - September 25, 2008 - 02:54
Project:Backup and Migrate
Version:6.x-2.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Instead of just being able to set backups to run every X number of hours how about doing something similar to cron jobs where you can set it to run every X hours or at a specific time daily or certain days of the week etc.

btw this is a great module

#1

ronan - September 29, 2008 - 03:23
Version:6.x-1.0» 6.x-2.x-dev

Hmm.. not a bad idea, I can see the value in having the module run in off-peak hours. I'll put it on the todo for version 2 (version 1 is feature stable)

#2

radman16 - October 1, 2008 - 19:23

Great, I will look forward to trying out version 2.

#3

2noame - July 30, 2009 - 18:27

I second this. I'd love to be able to set it to backup every day around 0500.

#4

bluerobot - September 16, 2009 - 16:03

I just used the devel module's variable editor and the online tool at http://www.unixtimestamp.com to change my settings. I'll try to remember to come back and report success or failure.

#5

bluerobot - September 21, 2009 - 14:31

The technique I tried in post #4 did work - took a couple of rounds to get it to stick. However, the backup time is creeping up an hour a day.

#6

gazelle - September 24, 2009 - 16:22

What variable did you change? I only can see:

backup_migrate_destination_id
backup_migrate_profile_id
backup_migrate_source_id

#7

ronan - September 26, 2009 - 17:11

I'm not sure what excactly @bluerobot did, but he probably edited the last run time of the schedule to make the module think it had run at 5am so that it would run again 24 hours later.

To stop the time creep, try setting the period to slightly below 24 hours. 1430 minutes for example. That way the period will definitely have expired by the time cron runs and execution gets to backup and migrate.

#8

kswan - October 11, 2009 - 03:18

This would definitely be a useful feature. I am considering preparing a patch, but there are a few different directions I am considering.

  1. One option is to create a custom url for each schedule. Then the administrator could configure cron on their server to call that url on any schedule they want.
  2. Another option is to build in support for Elysia Cron (http://drupal.org/project/elysia_cron) or CronPlus (http://drupal.org/project/cronplus). I have no experience with either of these modules, but the concept of both of them are that every individual modules shouldn't have to reinvent cron scheduling.
  3. Of course a time field could be added to the "day" schedule interval so that the backup job would occur on the next cron job after the specified time. This quickly gets complicated when you start thinking about more use cases. For example, the case of weekly backups that should run on Sunday at 2:00am.

Options 1 and 2 are nice because they allow very flexible scheduling by leveraging existing scheduling code, but they are more complicated to administer.

Any thoughts on these options or some options I missed?

#9

adam_b - October 20, 2009 - 21:33

subscribing

Some cron mechanism sounds good to me, or could it be invoked by Actions or Rules?

#10

ronan - October 26, 2009 - 02:31

Backup and migrate can be run using actions, but only using the default settings. The module doesn't work with Rules, but it used to work with workflow_ng, so I should be able to add back Rules support fairly easily.

I'm not aware of any way to get cron-like scheduling with either Actions or Rules but if such a thing does exist then I can add better support for those modules to allow this feature to work.

Anybody know if this kind of scheduling is possible?

#11

gotheric - October 26, 2009 - 09:56

With elysia_cron http://drupal.org/project/elysia_cron everyone can associate a cron rule to backup_migrate_cron such as "0 0 * * 0" to run backup job every sunday at midnight.

A module developer can add a default rule to his module by adding some lines of php:

function backup_migrate_cronapi($op, $job = NULL) {
  switch ($op) {
    case 'list':
      return array(
        ' backup_migrate_cron' => 'Backup and migrate',
      );
    case 'rule':
      return '0 0 * * 0';
  }
}

This way everyone installs backup and migrate and uses elysia cron will have the default execution rule to "every sunday at midnight".

#12

jaysonjust - November 7, 2009 - 22:37

Very interested as well. I like being able to take my site offline when the backup takes place but I don't want this to happen during business hours. I think option 1 here is the best so we don't have to reply on another module for something that seems simple. I don't think a specific time is as important as long as its just off peak. Settings cron jobs is pretty easy so I don't think this would be too much of a burden on administrators.

- Jayson

 
 

Drupal is a registered trademark of Dries Buytaert.