logoalt Hacker News

ta8903today at 7:11 AM3 repliesview on HN

Not technically related to atomicity, but I was looking for a way to do arbitrary filesystem operations based on some condition (like adding a file to a directory, and having some operation be performed on it). The usual recommendation for this is to use inotify/watchman, but something about it seems clunky to me. I want to write a virtual filesystem, where you pass it a trigger condition and a function, and it applies the function to all files based on the trigger condition. Does something like this exist?


Replies

laztoday at 11:15 AM

Sounds half baked. What context does this function run in? Is it an interpreted language or an executable that you provide?

Inotify is the way to shovel these events out of the kernel, then userspace process rules apply. It's maybe not elegant from your pov, but it's simple.

direwolf20today at 9:58 AM

are you asking for if statements?

if(condition) {do the thing;}

show 1 reply
Brian_K_Whitetoday at 7:26 AM

incron

show 1 reply