PHPとrsyncを使ってステージングもどき

| コメント(0) | トラックバック(0)

ステージング環境を簡単に作りたい時、シェルでrsyncを使えばすぐにできる。

index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ステージングもどきテスト</title>
</head>
<body>
<h1>ステージングもどきテスト</h1>
<a href="rsync.php">アップする</a>
</body>
</html>

rsync.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ステージングもどきテスト</title>
</head>
<body>
<h1>ステージングもどきテスト</h1>
<?php
$output = shell_exec('rsync  -av --delete /var/www/html/virtual/test/ /var/www/html/virtual/public/');
echo "<pre>$output</pre>";
?>
</body>
</html>

トラックバック(0)

トラックバックURL: http://www.kazy.jp/mt4/mt-tb.cgi/384

コメントする