AFAICT, the way most services do this is to have the command you want to run in ExecStop, then have RemainAfterExit=true which means that the service is always considered active and thus ExecStop only gets run when the system is shut down.
This seems a reasonable feature request for snapd, but admittedly is probably low priority right now.
The correct link seems to be https:/ /github. com/GoogleCloud Platform/ compute- image-packages/ blob/fa80cdb23d f0a7e190e228a9d 9d379922d1f0764 /packages/ google- compute- engine/ src/lib/ systemd/ system/ google- shutdown- scripts. service
AFAICT, the way most services do this is to have the command you want to run in ExecStop, then have RemainAfterExit =true which means that the service is always considered active and thus ExecStop only gets run when the system is shut down.
This seems a reasonable feature request for snapd, but admittedly is probably low priority right now.