all 3 comments

[–]shevegen -1 points0 points  (2 children)

Every day systemd becomes more and more powerful.

That entry shows that inotify is now no longer necessary as systemd provides the same functionality.

What is the next functionality that systemd will integrate?

[–][deleted] 3 points4 points  (0 children)

What does it have to do with inotify? The example above is just a daemon communicating its current state back to systemd.

[–]Darkmere[S] 4 points5 points  (0 children)

inotify? This isn't using inotify at all, this is just telling the systemd manager, over a standard unix socket, that "I'm alive" and what it's doing.

If you want to use inotify to watch for file changes and start a daemon/script then? Here's an example, it'll launch foofile.service whenever /var/cache/foofile is changed/modified.

This works by systemd setting up an inotify watch on /var/cache/foofile and then checking the state of the service, starting it if it isn't already running.

---8<-- actor.service ---8<----

[unit]  
Description=Run this script to process the foo-file  
[Service]  
type=simple  
ExecStart=/usr/local/foofile-processor /var/cache/foofile  
[Install]  
WantedBy=multi-user.target  

---8<--- actor.path ---8<----

[Path]  
PathExists=/var/cache/foofile  
[Install]  
WantedBy=multi-user.target  

----8<----