mo_ztt

joined 2 years ago
 

So, I need to monitor a fairly large nested directory tree for changes on Linux. It seems like there are a few different watcher modules that I could use -- fsnotify and notify being the main ones, both of which use the inotify interface and attempt to set watches on each individual subdirectory and maintain all their watchers as things change. I have way too many directories for that to be a workable approach. It looks like the underlying issue is just that this is a difficult problem on Linux; both inotify and fanotify have some issues which make them difficult for library authors to use to present a clean and useful API.

Long story short - I coded up an fanotify-based solution which seems like a good start of what I need, and I'm planning on sharing it back in the hopes that it's useful. I guess my question is, did I miss something? Is there already an easy and straightforward way to monitor a big directory for changes?

 

Bot: Hi, I'm Cricut Chatbot. ๐Ÿ‘‹ How can I help you?

Bot: Please select a topic, or feel free to ask me a question

Me: Hi hello, I just tried to load a project and my Cricut software showed a message "Project Open Unsuccessful: TypeError: Cannot read properties of undefined (reading 'layerData')". Can you help?

Bot: Please clarify, here's what I found ๐Ÿ‘‡

(Two options, I select "Javascript error messages")

Bot: Are you talking to me on the same device you wish to troubleshoot with?

Me: Yes

Bot: Which Cricut machine are you using?

Me: (I select "Cricut Maker")

Bot: JavaScript error messages are very diverse, but they are often fixed the same way. ๐Ÿ™‚

Bot: Installing Design Space over your current version is the most normal fix.

Bot: (Link: Download Design Space)

Bot: Replace the existing file rather than making a copy of Design Space. ๐Ÿ—ƒ

Me: (Selects "It works!" from the did-it-work options)

Bot: Great โ€” happy to help!


Absolutely amazing.

 

Me

Sounds good. Can you make a function to clone an existing FileNode, initializing Addr to nil and Children to be a clone of the Children of the source node?

// FileNode represents a node in the file system structure, which can be a file or a directory.
type FileNode struct {
	Type     NodeType
	Addr     *grits.FileAddr // Address of the CachedFile in BlobStore
	Children map[string]*FileNode
}

GPT

In DigitalOcean and similar cloud service providers, resources like droplets (virtual machines) continue to incur charges even when they are powered off because the underlying physical resources (CPU, RAM, disk space) allocated to the droplet are reserved and cannot be allocated to another customer. This policy ensures that you can quickly power on the droplet again without data loss or having to go through the setup process again. However, to avoid charges for resources you're not actively using, it's recommended to delete any droplets or resources that are no longer needed. Remember, data backups and snapshots should be kept if you need to preserve data from the droplet before deletion.

Edit: It's still going. I assumed it was just a one-off, and asked about JSON serialization in Go, and it showed me this:

Then it tried to run some python code, then admitted that the python code hadn't worked, and then it answered my Go question.

[โ€“] [email protected] 1 points 2 years ago

The town was infested with some sort of radioactivity from underground that was hurting people. I had to crawl underground, through these super-tight tunnels deep under the earth with things getting more and more evil as I went, until I was able to track the source of the radioactivity to a giant monster that lived back up on the surface (via the tunnels) in an abandoned barn. I had to fight the monster, but I could fly inside the barn. I ripped its head off, but every time I did, it was just like a big rubbery mask and a new head grew back, until I figured out how to do it fast enough that it wouldn't have time to pop a new head out. When I did that, the real head came out: Tux the Linux Penguin.

That broke the immersion enough that I woke up, all amped up from adrenaline from fighting the monster.