<div dir="ltr">Hi Enwei,<div><br></div><div>When your app is running, your app definitely knows since it is started. You can do something there.</div><div><br></div><div>When your app is stopped, you can also add a "<span style="color:rgb(51,51,51);font-family:"ubuntu mono",consolas,monaco,"lucida console","courier new",courier,monospace;font-size:16px;line-height:24px;white-space:pre-line">stop-command</span>" when you define your snapcraft.yaml. Please refer to  <a href="http://snapcraft.io/docs/build-snaps/syntax">http://snapcraft.io/docs/build-snaps/syntax</a></div><div><br></div><div>I do not know whether there are any hooks for this purpose.</div><div><br></div><div>Hope this helps!</div><div>XiaoGuo</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 21, 2016 at 11:22 AM, Enwei Zhang <span dir="ltr"><<a href="mailto:enwei.zhang@canonical.com" target="_blank">enwei.zhang@canonical.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi Xiaoguo and folks,<br></div>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?<br></div>Thanks.<br><br></div>Br<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888">Enwei<br></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 21, 2016 at 10:50 AM, Enwei Zhang <span dir="ltr"><<a href="mailto:enwei.zhang@canonical.com" target="_blank">enwei.zhang@canonical.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thank you so much Xiaoguo.<br></div></div><div class="m_6684695429000184472HOEnZb"><div class="m_6684695429000184472h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 21, 2016 at 10:30 AM, XiaoGuo Liu <span dir="ltr"><<a href="mailto:xiaoguo.liu@canonical.com" target="_blank">xiaoguo.liu@canonical.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Enwei,<div><br></div><div>There are a few ways to handle it. </div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Best regards,</div><div>XiaoGuo</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_6684695429000184472m_8303299205019500195h5">On Mon, Nov 21, 2016 at 10:23 AM, Enwei Zhang <span dir="ltr"><<a href="mailto:enwei.zhang@canonical.com" target="_blank">enwei.zhang@canonical.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_6684695429000184472m_8303299205019500195h5"><div dir="ltr"><div><div><div><div><div>Hello,<br></div>When I install a simple daemon snap, the daemon is started right after it is installed.<br></div>Suppose it stops due to some condition, is there a way to restart it?<br></div>Thanks a lot.<br><br></div>Br<span class="m_6684695429000184472m_8303299205019500195m_3105127960340149906HOEnZb"><font color="#888888"><br></font></span></div><span class="m_6684695429000184472m_8303299205019500195m_3105127960340149906HOEnZb"><font color="#888888">Enwei<br></font></span></div>
<br></div></div><span class="m_6684695429000184472m_8303299205019500195HOEnZb"><font color="#888888">--<br>
Snapcraft mailing list<br>
<a href="mailto:Snapcraft@lists.snapcraft.io" target="_blank">Snapcraft@lists.snapcraft.io</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/snapcraft" rel="noreferrer" target="_blank">https://lists.ubuntu.com/mailm<wbr>an/listinfo/snapcraft</a><br>
<br></font></span></blockquote></div><span class="m_6684695429000184472m_8303299205019500195HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_6684695429000184472m_8303299205019500195m_3105127960340149906gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">XiaoGuo, Liu </div></div></div></div>
</font></span></div>
<br>--<br>
Snapcraft mailing list<br>
<a href="mailto:Snapcraft@lists.snapcraft.io" target="_blank">Snapcraft@lists.snapcraft.io</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/snapcraft" rel="noreferrer" target="_blank">https://lists.ubuntu.com/mailm<wbr>an/listinfo/snapcraft</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>--<br>
Snapcraft mailing list<br>
<a href="mailto:Snapcraft@lists.snapcraft.io">Snapcraft@lists.snapcraft.io</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/snapcraft" rel="noreferrer" target="_blank">https://lists.ubuntu.com/<wbr>mailman/listinfo/snapcraft</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">XiaoGuo, Liu </div></div></div></div>
</div>