每次我递归复制我总是用httpdocs文件夹而不是public_html中的文件。
例如,我可能运行如下:
cp -rpf /var/www/vhosts/website/httpdocs /var/www/vhosts/anotherwebsite/httpdocs我总是最终使用/ var / www / vhosts / anotherwebsite / httpdocs / httpdocs,当我想要做的就是将网站从一个用户移动到另一个用户。
Every-time I copy recursively I always end up with httpdocs folder instead of the files within in public_html.
For example I might run something like:
cp -rpf /var/www/vhosts/website/httpdocs /var/www/vhosts/anotherwebsite/httpdocsI always end up with /var/www/vhosts/anotherwebsite/httpdocs/httpdocs when all I am trying to do is move a website from one user to another.
最满意答案
当您只想“推送”本地网站而不会长时间离线时,您可以使用临时目录。
TODAY=$(date +%y%m%d) NEWCODE=/var/www/vhosts/anotherwebsite/docs_${TODAY} OLDCODE=/var/www/vhosts/anotherwebsite/docs_old rm -rf ${NEWCODE} cp -rpf /var/www/vhosts/website/httpdocs ${NEWCODE} || exit 1 # some checks ? cd /var/www/vhosts/anotherwebsite/ || exit 1 mv httpdocs ${OLDCODE} || exit 1 mv ${NEWCODE} httpdocs在移动之间你将无法使用。 如果这是一个问题,您可能需要创建一个work_in_progress.html文件,将该文件重命名为httpdocs / index.html,删除所有其他文件并在此之后复制新文件(正确的index.html文件作为最后一个) 。 但这似乎很花哨,坚持上面的解决方案中的短暂的hickup。
When you just want to "push" your local website without getting offline long, you can use a temporary dir.
TODAY=$(date +%y%m%d) NEWCODE=/var/www/vhosts/anotherwebsite/docs_${TODAY} OLDCODE=/var/www/vhosts/anotherwebsite/docs_old rm -rf ${NEWCODE} cp -rpf /var/www/vhosts/website/httpdocs ${NEWCODE} || exit 1 # some checks ? cd /var/www/vhosts/anotherwebsite/ || exit 1 mv httpdocs ${OLDCODE} || exit 1 mv ${NEWCODE} httpdocsBetween the moves you will be unavailable. When that is a problem, you might want to make a work_in_progress.html file, rename that file to httpdocs/index.html, remove all other files and copy the new files after this (the correct index.html file as the last one). But this seems to fancy, stick with the short hickup in the solution above.
更多推荐
httpdocs,public_html,var,www,电脑培训,计算机培训,IT培训"/> <meta name="
发布评论