简体   繁体   English

是否可以创建虚拟符号链接?

[英]Is it possible to create a virtual symlink?

I have a web server that has the following directory structure我有一个具有以下目录结构的 Web 服务器

/var/www/html/www.example.com/wp-content/themes/exampletheme/custom

where "custom" is actually a symlink to /var/www/custom其中“custom”实际上是指向/var/www/custom的符号链接

This works as expected.这按预期工作。

However the theme updater deletes and recreates the entire exampletheme directory, which also deletes the "custom" symlink it contains, which breaks the site.然而,主题更新程序会删除并重新创建整个 exampletheme 目录,这也会删除它包含的“自定义”符号链接,这会破坏站点。

Is there a way to create a persistent filesystem location (maybe in fstab?) that would make "custom" always appear in the /var/www/html/www.example.com/wp-content/themes/exampletheme/ directory?有没有办法创建一个持久的文件系统位置(可能在 fstab 中?),使“自定义”始终出现在/var/www/html/www.example.com/wp-content/themes/exampletheme/目录中?

I found something sort of similar using udev, but it only works for devices.我使用 udev 发现了一些类似的东西,但它只适用于设备。

I had considering using cron to keep checking and create it if it's missing, but that's kind of kludgy.我曾考虑使用 cron 来继续检查并创建它(如果它丢失),但这有点笨拙。

You can bind-mount /var/www/custom onto /var/www/html/www.example.com/wp-content/themes/exampletheme/custom .您可以/var/www/custom 绑定/var/www/html/www.example.com/wp-content/themes/exampletheme/custom

Mount points cannot be deleted, only unmounted, and that (a) requires root privileges and (b) not something programs usually resort to when they can't delete something.挂载点无法删除,只能卸载,并且 (a) 需要 root 权限,并且 (b) 程序在无法删除某些内容时通常会求助于这些内容。 So that should work.所以这应该有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM