Auto start of snap application on boot up

Sergio Schvezov sergio.schvezov at canonical.com
Thu Sep 8 19:44:07 UTC 2016



El 08/09/16 a las 16:10, Daniel Manrique escribió:
> On Thu, Sep 8, 2016 at 3:05 PM, Jenny Murphy <jenny.murphy at episensor.com> wrote:
>> Hi,
>>   I would like my snap application to start automatically when the system
>> boots. On a non snappy platform I would add the start line to /etc/rc.local,
>> but I see that this is not possible on Ubuntu 15.04 with Snappy.
>> So can someone please advise the alternative?
>> Thanks.
> Hello,
>
> I start a daemon like this:

This is 16.04 terminology...
>
> apps:
>      my-nice-daemon:
>          command: bin/my-nice-daemon-server
>          daemon: simple
>          plugs: [network-bind]
>
>
> my-nice-daemon-server is a simple shell wrapper that sets things up
> and starts the daemon.
>
> This will start when the system boots (or when the snap is installed,
> so snap install your-snap will get the service running with no extra
> work).

You want something like 
https://github.com/snapcore/snapcraft/blob/1.x/examples/shout/snapcraft.yaml

So

services:
     <service-name>:
         start: <start-command>
         description: <your-service-description>

There are many more keywords that can be used here which are described 
in https://github.com/snapcore/snapd/blob/15.04/docs/meta.md (and might 
also be in that manual link I shared with you)

Cheers
Sergio




More information about the Snapcraft mailing list