为什么我的热部署文件有时会消失? (我认为Apache吃了它们)

时间:2022-06-01 16:50:28

Here's my situation:

这是我的情况:

  • Windows Server
  • Apache
  • CruiseControl

The last step of my CruiseControl deploy scripts copies the build to Apache's htdocs folder, in a "demos" folder (I believe this is referred to as a "hot deploy"?)

我的CruiseControl部署脚本的最后一步将构建复制到Apache的htdocs文件夹,在“demos”文件夹中(我相信这被称为“热部署”?)

All is good and dandy, except that SOMETIMES (not common, but it happens enough that it bugs me), the demos folder doesn't contain the files I built! The old one is gone and the new one isn't there, just vanished.

一切都很好,花花公子,除了有点(不常见,但它足以让我烦恼),demos文件夹不包含我建立的文件!旧的已经消失,新的不存在,只是消失了。

My gut feeling is that if I try to overwrite a file while someone on the web is downloading it, Apache just deletes it after the download is done? I don't know, it doesn't make any sense.

我的直觉是,如果我在Web上有人下载文件时尝试覆盖文件,Apache会在下载完成后删除它吗?我不知道,这没有任何意义。

I looked everywhere and couldn't find even a hint...let's see how good this * community really is! :)

我到处寻找,甚至找不到提示......让我们看看这个*社区到底有多好! :)

Here's the "deploy" target in my ANT script:

这是我的ANT脚本中的“部署”目标:

<target name="deploy" depends="revertVersionFile">
    <copy todir="${deploy.dir}">
        <fileset dir="${bin.dir}"/>
    </copy>
    <copy todir="${deploy.dir}">
        <fileset dir="${bin.dir}"/>
    </copy>
    <available file="${deploy.dir}/MockupsLive.swf" property="mockupsFile"/>
    <fail unless="mockupsFile" message="MockupsLive doesn't exist!"/>       
    <available file="${deploy.dir}/skins/sketch/sketch.swf" property="skinFile"/>
    <fail unless="skinFile" message="sketch.swf doesn't exist!"/>       
</target>   

3 个解决方案

#1


1  

I would suggest creating a backup of the old files prior to copying the new files out. Name the old files with the timestamp for when they were replaced. Doing this and then seeing what is in the directory the next time it fails will most likely give you a clue as to where to look next.

我建议在复制新文件之前创建旧文件的备份。将旧文件命名为更换时间的时间戳。执行此操作,然后在下次失败时查看目录中的内容,很可能会为您提供下一步查看位置的线索。

#2


0  

Apache won't delete the contents of the directory. Something in the script is removing the contents would be my guess. Does the script create a backup of any kind? Maybe it moves the contents to a backup folder and then copies the build.

Apache不会删除目录的内容。脚本中的东西是删除内容将是我的猜测。脚本是否创建了任何类型的备份?也许它将内容移动到备份文件夹然后复制构建。

You could add a bit of security to that folder to prevent its deletion. Maybe then an error would pop up somewhere and give you an idea as to what is conveniently deleting the directory. :) My guess is its in the script.

您可以为该文件夹添加一些安全性以防止其被删除。也许然后会在某处弹出错误,并让您知道什么是方便删除目录。 :)我的猜测是它在脚本中。

#3


0  

I think the problem might be somewhere in the CruiseControl file. Most likely what is happening is that the CruiseControl process is tidying up the files somewhere, but maybe due to a lock on the files (potentially by Apache) it cannot write the files back into that folder.

我认为问题可能出现在CruiseControl文件中。最有可能发生的事情是CruiseControl进程正在整理某些文件,但可能由于文件锁定(可能是Apache),它无法将文件写回该文件夹。

Either way, since "deploy" seems to be the last step, previous steps probably clear the directory and deploy is failing to run, leaving your folder empty at the end of the steps.

无论哪种方式,由于“部署”似乎是最后一步,之前的步骤可能会清除目录并且部署无法运行,在步骤结束时将文件夹留空。

#1


1  

I would suggest creating a backup of the old files prior to copying the new files out. Name the old files with the timestamp for when they were replaced. Doing this and then seeing what is in the directory the next time it fails will most likely give you a clue as to where to look next.

我建议在复制新文件之前创建旧文件的备份。将旧文件命名为更换时间的时间戳。执行此操作,然后在下次失败时查看目录中的内容,很可能会为您提供下一步查看位置的线索。

#2


0  

Apache won't delete the contents of the directory. Something in the script is removing the contents would be my guess. Does the script create a backup of any kind? Maybe it moves the contents to a backup folder and then copies the build.

Apache不会删除目录的内容。脚本中的东西是删除内容将是我的猜测。脚本是否创建了任何类型的备份?也许它将内容移动到备份文件夹然后复制构建。

You could add a bit of security to that folder to prevent its deletion. Maybe then an error would pop up somewhere and give you an idea as to what is conveniently deleting the directory. :) My guess is its in the script.

您可以为该文件夹添加一些安全性以防止其被删除。也许然后会在某处弹出错误,并让您知道什么是方便删除目录。 :)我的猜测是它在脚本中。

#3


0  

I think the problem might be somewhere in the CruiseControl file. Most likely what is happening is that the CruiseControl process is tidying up the files somewhere, but maybe due to a lock on the files (potentially by Apache) it cannot write the files back into that folder.

我认为问题可能出现在CruiseControl文件中。最有可能发生的事情是CruiseControl进程正在整理某些文件,但可能由于文件锁定(可能是Apache),它无法将文件写回该文件夹。

Either way, since "deploy" seems to be the last step, previous steps probably clear the directory and deploy is failing to run, leaving your folder empty at the end of the steps.

无论哪种方式,由于“部署”似乎是最后一步,之前的步骤可能会清除目录并且部署无法运行,在步骤结束时将文件夹留空。