Recently, I just had an idea which turned out to be pretty useful under certain circumstances. But first some simple explanation:

In Perl, you have the option to tie variables to some functions which are called when the variable is used. E.g. for: "Write the changes of that variable to HD every time it is changed". This is pretty useful in a lot of situations. See the perldoc for more detailed explanations: http://perldoc.perl.org/functions/tie.html

So I had an idea: Is it possible to bind files in Unix/Linux in general (or on any specific file system, just for curiosity, though I use ext4 mainly) to scripts?

One example where this would be really useful would be crontab. This file is not quite simple to maintain automatically if you have a lot of cronjobs and a lot of different persons working on it. Everytime it needs to be changed and so on and so forth. Here, a database would come in handy, where all the information needed is stored + a script which turns the information in the Database to something cron can understand.

So, my idea basically is, in this example, not to have the crontab file but instead having it linked to a script, lets say /root/crontab.pl. In my mind, every time the OS tries to find the crontab itself, it would instead see: "Oh, file doesn't exist, though. It's tied to this and that. I should execute that script and the output of it will be used as if it was the file", so being totally transparent to the programs itself.

Of course, there are other ways to achieve this thing: replacing the file, this and that and so on and so forth, but the basic idea should be kind of clear.

I actually haven't found anything like that in my research, though, because I mainly program Perl and I'm used to call that thing "tie" and don't know any other words for that, that might be my fault.

So: Is there anything? And, if not: Does anything speak against such a feature? I really think there are plenty situations where that would be awesome.


You could use FUSE to provide a userland hook into specific parts of the filesystem, causing scripts to run when the appropriate files are frobbed.


How do you document it? How will the next system administrator discover that the side-effect of running a command 7 million times would be overblown logs, filled partition and kernel panic? This feature is prone to abuse; the same as in programming, the web of side-effects may be too involved and complicated to accurately predict all the consequences of one small change.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.