snappy services - auto restart

Loïc Minier loic.minier at ubuntu.com
Tue May 5 08:54:10 UTC 2015


Hi,

I agree with Sergio that restart by default makes sense for snaps; until we
validate and implement this simple change in a snappy version I suggest you
use a small loop in your startup script as a workaround:
while true; do
    run-service-real || true
    sleep 1
done

systemd should be clever enough to track the whole process group and kill
it properly too.

Cheers,

On Thu, Apr 30, 2015 at 5:06 PM, Myles Caley <myles at firstbuild.com> wrote:

> Ok, I jumped the gun on the hack, looks like the .service files for the
> snaps are auto-generated at startup. Is there a template I can modify
> somewhere for now?
>
> From: Myles Caley <myles at firstbuild.com>
> Date: Thursday, April 30, 2015 at 10:36 AM
> To: Sergio Schvezov <sergio.schvezov at canonical.com>, Dustin Kirkland <
> kirkland at canonical.com>
> Cc: Steve Langasek <steve.langasek at canonical.com>, Snappy Dev List <
> snappy-app-devel at lists.ubuntu.com>
> Subject: Re: snappy services - auto restart
>
> Thanks Sergio. Confirmed that restart is not enabled by default. I
> modified the .service file which is definitely a hack. For our needs, just
> having auto-restart by default when installing the snap package is fine.
> Having additional controls exposed through the snappy utils is not
> necessary for us if this is enabled.
>
>
> From: Sergio Schvezov <sergio.schvezov at canonical.com>
> Date: Saturday, April 25, 2015 at 11:56 AM
> To: Dustin Kirkland <kirkland at canonical.com>
> Cc: Myles Caley <myles at firstbuild.com>, Steve Langasek <
> steve.langasek at canonical.com>, Snappy Dev List <
> snappy-app-devel at lists.ubuntu.com>
> Subject: Re: snappy services - auto restart
>
> On Thu, Apr 23, 2015 at 12:20 PM, Dustin Kirkland <kirkland at canonical.com>
> wrote:
>
>> On Mon, Apr 20, 2015 at 11:05 AM, Myles Caley <myles at firstbuild.com>
>> wrote:
>> > Is there a way to configure services in snapps to auto-restart if the
>> > process dies? Along the same lines, is there a way via snappy CLI to
>> > manually restart a service if it does die?
>>
>> Hmm, that should be a systemd thing, I suspect.
>>
>> Sergio, et al, any ideas?
>>
>
> From my point of view we should be autorestarting services, if that's not
> the case, I guess we want to fix that.
>
> For the latter, we don't have a snappy interface to restart services (we
> could expose one, not sure about the granularity though), for now here's a
> cheatsheet:
>
> Manage and check state:
> sudo systemctl [start|stop|restart|status]
> [package_name]_[service_name]_[package_version].service
>
> eg; webdm 0.6 has a service called avahi, so I would
>
> sudo systemctl start webdm_avahi_0.6.service
>
> Check logs
> sudo journalctl -u [package_name]_[service_name]_[package_version].service
>
> e.g.; to check the aforementioned service's logs:
>
> sudo journalctl -u  webdm_avahi_0.6.service
>
>
> --
> snappy-app-devel mailing list
> snappy-app-devel at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/snappy-app-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snappy-app-devel/attachments/20150505/4194f806/attachment.html>


More information about the snappy-app-devel mailing list