Last active
November 15, 2016 22:31
-
-
Save DicsyDel/3834c86ed53f1a0aed4c6f2dd5a5b453 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$password = $dbServer->GetProperty(ServerProperty::AZURE_ADMIN_PASSWORD); | |
@fwrite($shell, "echo \"{$password}\" | sudo -S chmod 0777 /tmp/scalarizr-installer.sh 2>&1" . PHP_EOL); | |
$output = @fgets($shell, 4096); | |
\Scalr::getContainer()->logger(\LOG_CATEGORY::FARM)->warn(sprintf( | |
_("Agent deploy verbose #1: %s"), | |
$output | |
)); | |
@fwrite($shell, "echo \"{$password}\" | sudo -S touch /var/log/scalarizr-installer.log 2>&1" . PHP_EOL); | |
$output2 = @fgets($shell, 4096); | |
\Scalr::getContainer()->logger(\LOG_CATEGORY::FARM)->warn(sprintf( | |
_("Agent deploy verbose #2: %s"), | |
$output2 | |
)); | |
@fwrite($shell, "echo \"{$password}\" | sudo -S chmod 0666 /var/log/scalarizr-installer.log 2>&1" . PHP_EOL); | |
$output3 = @fgets($shell, 4096); | |
\Scalr::getContainer()->logger(\LOG_CATEGORY::FARM)->warn(sprintf( | |
_("Agent deploy verbose #3: %s"), | |
$output3 | |
)); | |
@fwrite($shell, "echo \"{$password}\" | sudo -S setsid /tmp/scalarizr-installer.sh > /var/log/scalarizr-installer.log 2>&1 &" . PHP_EOL); | |
$output4 = @fgets($shell, 4096); | |
\Scalr::getContainer()->logger(\LOG_CATEGORY::FARM)->warn(sprintf( | |
_("Agent deploy verbose #4: %s"), | |
$output4 | |
)); | |
sleep(5); | |
$meta = stream_get_meta_data($shell); | |
\Scalr::getContainer()->logger(\LOG_CATEGORY::FARM)->warn(sprintf( | |
_("Agent deploy verbose META #1: %s"), | |
json_encode($meta) | |
)); | |
if ($meta['eof'] == false && $meta['unread_bytes'] != 0) { | |
$output5 = @fread($shell, $meta['unread_bytes']); | |
\Scalr::getContainer()->logger(\LOG_CATEGORY::FARM)->warn(sprintf( | |
_("Agent deploy verbose #5: %s"), | |
$output5 | |
)); | |
$meta = stream_get_meta_data($shell); | |
\Scalr::getContainer()->logger(\LOG_CATEGORY::FARM)->warn(sprintf( | |
_("Agent deploy verbose META #2: %s"), | |
json_encode($meta) | |
)); | |
} | |
@fclose($shell); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment