Can Linux serve "virtual" files which are (re)produced by script when accessed?
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can Linux serve "virtual" files which are (re)produced by script when accessed?
Is it possible to run a Linux file server which lists files which don't actually exist, but rather are generated on the fly by a (bash) script that runs and returns file data every time the given file is requested??
For example, I have a huge store of XCF images. I want to keep the XCF images, but for many purposes I must access these images as PNG files. I don't want to keep multiple copies of each image, and I don't want to have to save an image twice each time I edit it. What I would like is a FTP or SMB file server which lists each image twice, but serves the original every time the XCF is accessed, and uses imagemagick to convert the XCF into PNG on the fly, and serves that data every time the PNG is accessed.
I know that there is a time trade off here, but this scenario totally fits my use-case, and I would deeply appreciate if anyone could direct me in accomplishing this.
This is an new experience for me. I've never heard of anyone trying to do this, and I can't seem to type the right google searches to find others on the world who have done the same thing. Yet it seems like it should be totally possible through the power of Linux.
I guess this would be like a really fancy and advanced link, but one which links to info that has yet to be produced. (Kinda like /dev/random ?)
Your best bet is using a web application, that lists out the files, and does the conversion when you click, and serves up converted file.
It should be pretty simple to do in php/perl. I don't know of any projects off the top of my head that do this already, though.
Thanks for a quick response!
I wish I didn't have to learn a new language, and this probably won't work with my specific program needs, but maybe I can just run a cron script that creates actual copies of the images and updates them daily, although this would not be ideal in my mind. Any other ideas would be great...
You would have to add a function in there for file conversion, but it shouldn't be very difficult.
Thanks for the suggestion, I think that instead of this, I will probably just make a cron script which (re)produces png files for all of the xcf files in my directory, on a given time basis (every night).
If anyone knows how to do otherwise, I would be glad to know.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.