Sample Header Ad - 728x90

systemd .mount for FUSE fs via executable (or waiting for transient mount)

3 votes
1 answer
197 views
I have a Python script that utilizes FUSE bindings to create a FUSE filesystem. I would like to run the script automatically via systemd and have other units wait until the mount is created. I can easily have a systemd .service file to launch the script like
[Service]
Type=simple
ExecStart=/usr/bin/python -u my-fuse-script.py /some/mount/point
but I also want to have other units wait until the mount is actually created. The script can take seconds or minutes before actually doing the mount, so I can't just use Requires= and After= to wait for the above unit. I do end up with a transient .mount like some-mount-point.mount after the FUSE fs is actually created, but having other units depend on it like Requires=some-mount-point.mount (with After=) will fail because the .mount does not exist for some time. Maybe writing a persistent .mount file is a possible solution, but then I'm not sure what to add to the What= field in the .mount, given that the mount is created by a script. I see in man systemd.mount that a .mount can have [Unit] and [Install] sections which sounds promising if I want to run my script there, but What= is still required. Or is there some way to wait on or start units after a transient .mount?
Asked by tsj (207 rep)
May 12, 2025, 01:31 AM
Last activity: May 12, 2025, 12:25 PM