Skip to content

Commit

Permalink
起動しているクローラサーバを破棄するコマンド実装 #35
Browse files Browse the repository at this point in the history
  • Loading branch information
app2641 committed Sep 19, 2014
1 parent ff3732e commit e0ea30f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<directory suffix=".php">src</directory>
<exclude>
<directory>src/Midnight/Commands</directory>
<directory>src/Midnight/Aws</directory>
<directory>src/Library</directory>
<file>src/Bootstrap.php</file>
</exclude>
Expand Down
45 changes: 45 additions & 0 deletions src/Midnight/Commands/TerminateCrawler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

use Emerald\Command\AbstractCommand;
use Emerald\Command\CommandInterface;

use Midnight\Aws\AutoScaling;

class TerminateCrawler extends AbstractCommand implements CommandInterface
{

/**
* コマンドの実行
*
* @param array $params パラメータ配列
* @return void
**/
public function execute (array $params)
{
try {
$options = array(
'AutoScalingGroupName' => 'ModernAdultMidnightCrawlerGroup',
'MinSize' => 0,
'MaxSize' => 0,
'DesiredCapacity' => 0
);

$as = new AutoScaling();
$as->updateAutoScalingGroup($options);

} catch (\Exception $e) {
$this->errorLog($e->getMessage());
}
}


/**
* ヘルプメッセージの表示
*
* @return String
**/
public static function help ()
{
return '起動しているクローラサーバを破棄する';
}
}
2 changes: 1 addition & 1 deletion src/Midnight/Commands/UpdateScheduledAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ private function _updateScheduledAction ()
**/
public static function help ()
{
return 'ModernAdultMidnigtCrawlerGroupのScheduledActionを更新する';
return 'ModernAdultMidnightCrawlerGroupのScheduledActionを更新する';
}
}

0 comments on commit e0ea30f

Please sign in to comment.