Answer the question
In order to leave comments, you need to log in
Systemd: removable drives - automount and start services - how to do?
Hello.
Tell me how to beautifully make the following script on systemd:
1. USB HDD is connected to the system.
2. systemd mounts its partitions by partition UUIDs.
3. After mounting a certain partition (which corresponds to a given mount point, for example mnt-backups.mount), a certain service (for example, rsync.service) is started.
I know that in order for the rsync.service service to stop when /mnt/backups/ is unmounted, you need to execute systemctl edit rsync.service and enter the following into it:
[Unit]
BindsTo=mnt-backups.mount
Answer the question
In order to leave comments, you need to log in
The question is how to achieve the opposite effect (so that rsync.service is automatically started when /mnt/backups/ is mounted)?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question