[Cialug] Auto create link in a folder

Pixie pix at kepibu.org
Sun May 17 18:24:12 CDT 2015


This sounds like a perfect fit for a union mount for the staging
directory (see unionfs, aufs, overlayfs).

Something like:
  unionfs-fuse
/var/www/staging/wp-content/uploads-real=RW:/var/www/live/wp-content/uploads=RO
/var/www/staging/wp-content/uploads

(overlayfs may make more sense, depending on your kernel version.)



On 2015.05.17 16:23, Matthew Nuzum wrote:
> I have a live wordpress site and a staging wordpress site. I have a
> job that can periodically copy the live site over to staging to keep
> the test site relatively up to date. However, this site deals with
> large files and it is wasteful to keep a duplicate copy of them on
> the same drive.
> 
> What I’d like to do is create a link for the files in the live site
> over to staging whenever it is created. I don’t care if the links are
> soft or hard. For example,
> 
> If a file is created in /var/www/live/wp-content/uploads
> automatically create a link to it in
> /var/www/staging/wp-content/uploads.
> 
> I can create a batch job that does this every so often, but is there
> an easy way to have it happen automatically? I seem to remember a
> service that will watch file for file modifications and do something
> on demand. That seems like an efficient way to do it. I was thinking
> the service was called iwatch or similar, but searching for that only
> shows me stuff about the Apple Watch.
> 
> Here’s what I don’t want to do: I don’t want to symlink the uploads
> folder. I want to be able to upload files to staging without them
> going to live.
> 



More information about the Cialug mailing list