Systemd service parameters unsupported by Snap

Hello I am trying to expose a Snap service by writing an existing service file into the Snapcraft friendly format (YAML). I have checked the Snapcraft app and service metadata documentation but found out the following common service parameters missing in it.


Can you suggest how to configure these parameters for a Snap service?

This is implemented with stop-command.

This is not yet supported but will be supported via the snap quota feature that is experimental.

You can set environment variables via the environment keyword under a snap app.

Can you explain your use case for changing this? The SyslogIdentifier is already set as snap.<name-of-snap>.<name-of-app>

What is the use case for using RemainAfterExit with a snap service?

These are not yet supported.

I need to set few environment variables from install hook. Without env file how can I set the environment variables of snap service from install hook?

you set it in your apps: entry of your snapcraft.yaml like ian said above … here is an example:

But is it possible implement the following using Snap service metadata?

Since these two targets are not available as typical Snap apps.

I think ordering of services only works between services shipped in the same snap (snaps can simply not see the outside, so they will not see the services there)

I think this example doesn’t solve my issue. I want Snap to get the environment variable value from a file which will be written during the install hook. To get a clearer picture I want to run a few calculations during install time for every user and set its result as an environment variable to my Snap service. Is this possible?

the install hook runs system wide as root, you will not have access to any user data or files, you should rather use a command-chain wrapper to do any initial per-user setup.

Thanks I am exporting variables from command-chain wrapper script hoping that these will be available during the execution snap service. Also just to confirm this wrapper script will be run from $SNAP as working directory right?