Container.Stop function

feature/node-rewrite
Sven Slootweg 13 years ago
parent a427994a90
commit 11f05e4334

@ -137,6 +137,23 @@ class Container extends CPHPDatabaseRecordClass
}
}
public function Stop()
{
$command = "vzctl stop {$this->sInternalId}";
$result = $this->sNode->ssh->RunCommand($command, false);
if($result->returncode == 0 && strpos($result->stderr, "Unable to stop") === false)
{
$this->uStatus = CVM_STATUS_STOPPED;
$this->InsertIntoDatabase();
return true;
}
else
{
throw new ContainerStopException($result->stderr, $result->returncode, $this->sInternalId);
}
}
public function EnableTunTap()
{
// TODO: Finish EnableTunTap function, check whether tun module is available on host

@ -7,7 +7,18 @@ $settings['master_pubkey'] = "/etc/cvm/key.pub";
$sContainer = new Container(1);
$sContainer->Start();
if($_GET['action'] == "start")
{
$sContainer->Start();
}
elseif($_GET['action'] == "stop")
{
$sContainer->Stop();
}
echo("Done!");
?>
<br><br>
<a href="?action=start">Start</a><br>
<a href="?action=stop">Stop</a><br>

Loading…
Cancel
Save