标签:
#!/bin/sh
# 库的路径
REPOS=”$1″
# 新提交的版本号
REV=”$2″
WEB=/data/web
FRAMEWORK=/data/framework
export LC_ALL=zh_CN.UTF-8
changed=$(svnlook changed -r $REV $REPOS)
log=$(svnlook log -r $REV $REPOS)
n=$’\n’
/usr/local/php/bin/php-cgi -q /data/shell/svn_post_commit_resources.php “$changed” &
————————————–
处理更新内容,执行更新命令的PHP脚本文件 svn_post_commit_resources.php 的内容:
—————————————–
$files = explode("\n", $argv[1]);
if (!is_array($files)) {$files=(array)$files;};
foreach ($files as $v)
{
// 取文件名
$f_tem = trim(substr($v, 2));
// 取最顶层目录名
$d_tem = substr($f_tem, 0, strpos($f_tem, ‘/‘));
if (!in_array($d_tem, array(‘web‘, ‘framework‘, ‘conf‘, ‘shell‘))) {
continue;
}
// SVN copy 对应的文件
$f_name = ‘/data/‘ . $f_tem;
$cmd = "svn update ‘$f_name‘ --username x****i --password K****$;chown www.www ‘$f_name‘";
exec($cmd);
if (strpos($f_tem, ‘nginx.conf‘)) {
exec("kill -HUP `cat /dev/shm/nginx.pid`");
}
}
exit();
?>
标签:
原文地址:http://my.oschina.net/u/267858/blog/383260