How to restart a simple daemon?

XiaoGuo Liu xiaoguo.liu at canonical.com
Mon Nov 21 03:30:03 UTC 2016


Hi Enwei,

When your app is running, your app definitely knows since it is started.
You can do something there.

When your app is stopped, you can also add a "stop-command" when you define
your snapcraft.yaml. Please refer to
http://snapcraft.io/docs/build-snaps/syntax

I do not know whether there are any hooks for this purpose.

Hope this helps!
XiaoGuo

On Mon, Nov 21, 2016 at 11:22 AM, Enwei Zhang <enwei.zhang at canonical.com>
wrote:

> Hi Xiaoguo and folks,
> Is there a notification/callback mechanism so that when snap
> enable/disable is executed on my snap, my snap can receive notification to
> do some corresponding actions?
> Thanks.
>
> Br
> Enwei
>
> On Mon, Nov 21, 2016 at 10:50 AM, Enwei Zhang <enwei.zhang at canonical.com>
> wrote:
>
>> Thank you so much Xiaoguo.
>>
>> On Mon, Nov 21, 2016 at 10:30 AM, XiaoGuo Liu <xiaoguo.liu at canonical.com>
>> wrote:
>>
>>> Hi Enwei,
>>>
>>> There are a few ways to handle it.
>>>
>>> 1) You do not need to make it a daemon before it is getting stable. When
>>> your run your app, just use "sudo" to run it on command line. When it is
>>> stable, change it to daemon.
>>>
>>> 2) You can use "snap enable/disable" to toggle the state of the app.
>>> When it is enabled, it starts to run again. In your case, your daemon app
>>> will be restarted.
>>>
>>> Best regards,
>>> XiaoGuo
>>>
>>> On Mon, Nov 21, 2016 at 10:23 AM, Enwei Zhang <enwei.zhang at canonical.com
>>> > wrote:
>>>
>>>> Hello,
>>>> When I install a simple daemon snap, the daemon is started right after
>>>> it is installed.
>>>> Suppose it stops due to some condition, is there a way to restart it?
>>>> Thanks a lot.
>>>>
>>>> Br
>>>> Enwei
>>>>
>>>> --
>>>> Snapcraft mailing list
>>>> Snapcraft at lists.snapcraft.io
>>>> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailm
>>>> an/listinfo/snapcraft
>>>>
>>>>
>>>
>>>
>>> --
>>> XiaoGuo, Liu
>>>
>>> --
>>> Snapcraft mailing list
>>> Snapcraft at lists.snapcraft.io
>>> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailm
>>> an/listinfo/snapcraft
>>>
>>>
>>
>
> --
> Snapcraft mailing list
> Snapcraft at lists.snapcraft.io
> Modify settings or unsubscribe at: https://lists.ubuntu.com/
> mailman/listinfo/snapcraft
>
>


-- 
XiaoGuo, Liu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20161121/2a8e70b7/attachment.html>


More information about the Snapcraft mailing list