For packages that are built from Git or SVN repos, it would be nice if an fserver cron task could automatically run drush fserver-package to build new releases.

Comments

eugenmayer’s picture

Well yeah, similar to the backup and migrate implementatino. Currently iam doing this with drush fserver-apckage and the server cron

danepowell’s picture

Yeah, unfortunately I can't do it with system cron because my feature server site is managed in Aegir, and thus the system path of the site changes frequently.

eugenmayer’s picture

Well we also use aegir, but i have implemented some extensions maintain let aegir maintain symlinks to the "sites" installed on server / remote. So under aegir you have (on the remote / client)
aegir/sites/yourdomain1
aegir/sites/yourdomain2
aegir/sites/yourdomain3

so you always can do those crons without caring for the current platform..

I have also implemented a small tool called "forallsites" and a small wrapper for drush, so i can do stuff like

forallsite mdrush -u 1 cron

We also deploy the aliases on the remotes ( .drush/yoursite ), so you can also run drush @yourdomaint -u 1 cron.

Anyway, we have a forked version of aegir, so wont help you too much here. But maybe the approaches / ideas are helpful

danepowell’s picture

I've figured out how to use system cron as you suggested. But I still thing this would be better handled internally. I think using hook_cron would be best- i.e.:

<?php

 * Implementation of hook_cron().
 */
function fserver_cron() {
  if (variable_get('fserver_cron', TRUE)) {
    drush_fserver_package();
  }
}

/**
 * Implementation of hook_perm().
 */
function fserver_perm() {
  return array('administer fserver');
}

/**
 * Implements hook_menu.
 */
function fserver_menu() {
  $items = array();
  $items['admin/settings/fserver'] = array(
    'title' => t('Feature server'),
    'description' => 'Configure feature server',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('fserver_admin_settings'),
    'access arguments' => array('administer fserver'),
    'type' => MENU_NORMAL_ITEM,
  );
  return $items;
}

/**
 * Provides settings pages.
 */
function fserver_admin_settings() {
  $form['fserver_cron'] = array(
    '#type' => 'checkbox',
    '#title' => t('Update packaging for projects on cron'),
    '#default_value' => variable_get('fserver_cron', 0),
  );
  return system_settings_form($form);
}
?>

Note that this doesn't work as-is, because drush_fserver_package() only really works if it's called from drush. I'm not sure how to call that command from the module.

danepowell’s picture

Status: Active » Needs work
danepowell’s picture

Just FYI, I've found that using system crontab is not viable, because Aegir wipes out the aegir user's crontab on upgrades. Have you found a workaround for this (other than manually fixing crontab each time)?