SVN update-commit Hook 需要帮助
我们有一个基于 Linux 的 Web 服务器(Media Temple),我们通过他们的 DV 托管解决方案托管多个域。我已经成功为我们的一个项目创建了 SVN 存储库,但现在我希望它能够在提交时同步实时 Web 文件夹。存储库和站点文件都位于同一服务器上...路径如下:
SVN 存储库位于:/home/svn/repositories/<站点名称>
实时站点文件位于:/var/www/vhosts/
我可以毫无问题地连接到存储库。实时网站也能正常工作。现在我只需要让它们同步。
我已按照指南创建了以下更新文件并正确更新了 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要将
post-commit.tmpl
重命名为post-commit
,即删除.tmpl
后缀。请参阅“实现存储库挂钩” 使用 Subversion 进行版本控制。(.tmpl 文件如此命名是为了表明它们是示例,是构建您自己的脚本的模板。)此外,您引用的指南建议将挂钩的所有权更改为 apache。它们实际上意味着您的存储库的所有者(对于指南作者来说显然是 apache)。
You need to rename
post-commit.tmpl
topost-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).
实际上还没有答案,但您可以在服务器上调整并执行这些命令来收集有关您的设置的一些信息:
请将输出附加到您的问题。
编辑 输出已无格式粘贴到一系列注释中。这是相关部分:
这意味着 $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:
Please attach the output to your question.
Edit The output has been pasted unformatted into a series of comments. Here is the relavant part:
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"