Skip to content

Commit

Permalink
Add jail_status command
Browse files Browse the repository at this point in the history
  • Loading branch information
lattera committed May 11, 2013
1 parent a178ca3 commit 0112a1c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.swp
29 changes: 29 additions & 0 deletions jailadmin.drush.inc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ function jailadmin_drush_command() {
'description' => 'Stop all jails',
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_LOGIN,
),
'jail_status' => array(
'description' => 'Display the status of all jails',
'arguments' => array(
'jailname' => 'Optional name of the jail to display',
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_LOGIN,
),
);
}

Expand Down Expand Up @@ -80,3 +87,25 @@ function drush_jailadmin_stopall() {
if ($jail->IsOnline())
$jail->Stop();
}

function drush_jailadmin_jail_status($jailname='') {
$jails = array();

if ($jailname == '')
$jails = Jail::LoadAll();
else
$jails[] = Jail::Load($jailname);

foreach ($jails as $jail) {
if ($jail === FALSE) {
drush_print("Jail {$jailname} not found");
continue;
}

$online = $jail->IsOnline() ? "Yes" : "No";

drush_print("{$jail->name}[Online] => {$online}");
if ($jail->IsOnline())
drush_print("{$jail->name}[Network] => " . $jail->NetworkStatus());
}
}

0 comments on commit 0112a1c

Please sign in to comment.