SVN update-commit Hook 需要帮助

发布于 2024-12-10 19:42:50 字数 1056 浏览 0 评论 0原文

我们有一个基于 Linux 的 Web 服务器(Media Temple),我们通过他们的 DV 托管解决方案托管多个域。我已经成功为我们的一个项目创建了 SVN 存储库,但现在我希望它能够在提交时同步实时 Web 文件夹。存储库和站点文件都位于同一服务器上...路径如下:

SVN 存储库位于:/home/svn/repositories/<站点名称>

实时站点文件位于:/var/www/vhosts//httpdocs/

我可以毫无问题地连接到存储库。实时网站也能正常工作。现在我只需要让它们同步。

我已按照指南创建了以下更新文件并正确更新了 POST-COMMIT.tmpl 但仍然没有骰子。 http://www.frenssen.be/content/using-subversion -automatically-update-live-website

这是我的更新程序中的代码:

#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
    execl("/usr/bin/svn", "svn", "update",
        "/var/www/vhosts/<domain>/httpdocs/<subdomain>",
        (const char *) NULL);
    return(EXIT_FAILURE);
}

我用以下内容调用了 POST-COMMIT.tmpl 文件中的程序:

#!/bin/sh
/home/svn/repositories/autoupdate/autoupdate

有什么想法我缺少什么吗?必须有一种更简单的方法来同步文件吗?

We have a Linux based web server (Media Temple) where we host several domains via their DV hosting solution. I have successfully created the SVN repository for one of our projects but now I would like it to sync the live web folder on committ. Both the repo and the site files are on the same server... Paths are as follows:

The SVN Repo is here: /home/svn/repositories/<site name>

The Live Site files are here: /var/www/vhosts/<domain>/httpdocs/<subdomain>

I can connect to the repo without problem. The live site works as well. Now I just need to get them to sync.

I have created the following update file as per guide and correctly updated the POST-COMMIT.tmpl but still no dice.
http://www.frenssen.be/content/using-subversion-automatically-update-live-website

Here is the code in my update program:

#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
    execl("/usr/bin/svn", "svn", "update",
        "/var/www/vhosts/<domain>/httpdocs/<subdomain>",
        (const char *) NULL);
    return(EXIT_FAILURE);
}

And I called the program in the POST-COMMIT.tmpl file with the following:

#!/bin/sh
/home/svn/repositories/autoupdate/autoupdate

Any ideas what I am missing? There has to be an easier way to get the files to sync?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

云淡风轻 2024-12-17 19:42:50

您需要将 post-commit.tmpl 重命名为 post-commit,即删除 .tmpl 后缀。请参阅“实现存储库挂钩” 使用 Subversion 进行版本控制。(.tmpl 文件如此命名是为了表明它们是示例,是构建您自己的脚本的模板。)

此外,您引用的指南建议将挂钩的所有权更改为 apache。它们实际上意味着您的存储库的所有者(对于指南作者来说显然是 apache)。

You need to rename post-commit.tmpl to post-commit—that is, remove the .tmpl suffix. See “Implementing Repository Hooks” from Version Control with Subversion. (The .tmpl files are named as such to show they're examples, templates upon which to build your own scripts.)

Also, the guide you referenced suggests changing ownership of the hook to apache. They actually mean whichever user owner your repository (which is apparently apache for the guide writer).

零時差 2024-12-17 19:42:50

实际上还没有答案,但您可以在服务器上调整并执行这些命令来收集有关您的设置的一些信息:

REPO=/home/svn/repositories/XYZ
WORK=/var/www/vhosts/FOO/httpdocs/BAR

set -x

ls -ld $REPO $REPO/hooks $REPO/hooks/post-commit* $REPO/db/revs
head -2 $REPO/hooks/post-commit | hexdump -C
svnlook youngest $REPO

ls -ld $WORK $WORK/.svn $WORK/.svn/entries
svn info $WORK

请将输出附加到您的问题。

编辑 输出已无格式粘贴到一系列注释中。这是相关部分:

svn info $WORK 
+ svn info /var/www/vhosts/unionjobtracker.com/httpdocs/pdc30/ 
svn: '/var/www/vhosts/unionjobtracker.com/httpdocs/pdc30' is not a working copy 

ls -ld $WORK $WORK/.svn $WORK/.svn/entries 
+ ls --color=tty -ld /var/www/vhosts/unionjobtracker.com/httpdocs/pdc30/ /var/www/vhosts/unionjobtracker.com/httpdocs/pdc30//.svn /var/www/vhosts/unionjobtracker.com/httpdocs/pdc30//.svn/entries

ls: /var/www/vhosts/unionjobtracker.com/httpdocs/pdc30//.svn: No such file or directory 
ls: /var/www/vhosts/unionjobtracker.com/httpdocs/pdc30//.svn/entries: No such file or directory 
drwxrwxrwx 8 root root 4096 Oct 19 13:15 /var/www/vhosts/unionjobtracker.com/httpdocs/pdc30/

这意味着 $WORK 不是 SVN 工作副本。您问题中的链接解释了“步骤 1:将存储库签出到 Web 根目录”部分中所需的步骤

No actually an answer (yet) but you could adapt and execute these commands on your server to gather some information about your setup:

REPO=/home/svn/repositories/XYZ
WORK=/var/www/vhosts/FOO/httpdocs/BAR

set -x

ls -ld $REPO $REPO/hooks $REPO/hooks/post-commit* $REPO/db/revs
head -2 $REPO/hooks/post-commit | hexdump -C
svnlook youngest $REPO

ls -ld $WORK $WORK/.svn $WORK/.svn/entries
svn info $WORK

Please attach the output to your question.

Edit The output has been pasted unformatted into a series of comments. Here is the relavant part:

svn info $WORK 
+ svn info /var/www/vhosts/unionjobtracker.com/httpdocs/pdc30/ 
svn: '/var/www/vhosts/unionjobtracker.com/httpdocs/pdc30' is not a working copy 

ls -ld $WORK $WORK/.svn $WORK/.svn/entries 
+ ls --color=tty -ld /var/www/vhosts/unionjobtracker.com/httpdocs/pdc30/ /var/www/vhosts/unionjobtracker.com/httpdocs/pdc30//.svn /var/www/vhosts/unionjobtracker.com/httpdocs/pdc30//.svn/entries

ls: /var/www/vhosts/unionjobtracker.com/httpdocs/pdc30//.svn: No such file or directory 
ls: /var/www/vhosts/unionjobtracker.com/httpdocs/pdc30//.svn/entries: No such file or directory 
drwxrwxrwx 8 root root 4096 Oct 19 13:15 /var/www/vhosts/unionjobtracker.com/httpdocs/pdc30/

That means, that $WORK is not a SVN-working copy. The link in your question explains the required steps in the section "Step 1: check out the repository to the web root"

独留℉清风醉 2024-12-17 19:42:50
  1. 网络树中的 WC 总是坏主意
  2. 当您将网站导入到存储库时,它不会自动将网站转换为 WC
  3. 如果您仍然想忽略我的 p.1,您必须1次执行svn co(之前清空???TBT)站点位置以便在其中获取WC
  4. 对于提交后挂钩(来自我的POV)更正确的方法是从站点中删除所有旧数据并svn将HEAD导出到站点-小路
  1. WC inside web-tree is always bad idea
  2. When you imported site to repo, it will not convert site automagically to WC
  3. If you still want ignore my p.1, you must 1 time perform svn co (to emptied previously??? TBT) site location in order to get WC in it
  4. More correct way for post-commit hook (from my POV) is remove all old data from site and svn export HEAD to site-path
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文