Running two executable in one SNAP?

Good morning.

is it possible to run 2 executable within one SNAP? When yes:

  • How to design the snapcraft.xmal? do i have a part section for each App executable?
  • How can i control the order of execution?
  • When thsi App have to comunicate to each oder (tcp localhost), how do i have use slots and plugs!?

Does everyone have a good example ?

Thank you very much

that depends on their source… parts are for building and completely unrelated to executing a snap … if both your binaries come from the same source build you obviously only need one part, if they come from different sources you use two … if they come pre-built from debian packages in the archive you use the dump plugin in one single part and simply list the packages you need in stage-packages

this depends on your kind of app … if it is a manually executed app you’d use a wrapper script that runs them in the correct order and simply define a single command in your apps: section of the snap that then runs the wrapper.

if you run two system services instead you can use the before: and after: statements with the daemon: option.

if it is just communication between two apps in the same snap you don’t need plugs/slots :slight_smile: (plugs and slots are only for communicating with or accessing the outside world or any system resources)

just make sure your apps both use the writable places your snap provides (i.e. if you have two daemons communicating through a socket this socket should live in $SNAP_DATA, for a user executed app you’d use $SNAP_USER_DATA… or you could simply use /tmp which is shared between all snap apps in the same snap)

thank you very much for the good explaintation