Automated full backup with systemd on btrfs

relating to https://lxd.readthedocs.io/en/latest/backup/
full backup = a copy of lxd folder

in my case:
btrfs snapshots of /var/snap/lxd/common/lxd

  • everything is on btrfs
  • lxd installed via snapd
  • all my Systems use systemd

aim:
if lxd will stopped:

  • os reboot, restart …
  • lxd update, reinstallation …
  • and so on

a snapshot based backup should done

requirement:

  • the lxd folder to be backup:

    • the lxd folder is a btrfs subvolume
    • had to mount before the start of “lxd” in place
  • sysytemd service:

    • listen to “lxd” start
    • trigger mount service
    • listen to “lxd” stop
    • start btrfs backup script

My question is:

how can I monitor the status of “lxd” with systemd?

snap.lxd.daemon.unix.socket only works for start
but not for stop “lxd”

  • tested with: snap remove lxd

Hello everyone,

just post to bring it up and
ask that a developer / expert / moderator take care of the case, please.
It would be far too time-consuming to find out everything for yourself.