You are here

function _hosting_default_restart_cmd in Hosting 5

This function should not have to be duplicated between hosting/provision

1 call to _hosting_default_restart_cmd()
hosting_init in ./hosting.module
Implementation of hook_init

File

./hosting.module, line 192
Hosting module

Code

function _hosting_default_restart_cmd() {
  $command = '/usr/sbin/apachectl';

  # a proper default for most of the world
  foreach (explode(':', $_SERVER['PATH']) as $path) {
    $options[] = "{$path}/apache2ctl";
    $options[] = "{$path}/apachectl";
  }

  # try to detect the apache restart command
  $options[] = '/usr/local/sbin/apachectl';

  # freebsd
  $options[] = '/usr/sbin/apache2ctl';

  # debian + apache2
  $options[] = $command;
  foreach ($options as $test) {
    if (is_executable($test)) {
      $command = $test;
      break;
    }
  }
  return "sudo {$command} graceful";
}