Service need to be restarted after account-control interface is connected


I use PAM to authenticate users in a web service in the snap. This use case requires the account-control interface.
The account-control interface is not auto connected. Normally after snap installed, the web server started before the account-control interface was connected.
It seems that the permissions were not granted to web service immediately after account-control is connected. Restart of web server is needed.

Then I use hook connect –plug-account-control to restart the web service automatically. It works.

Just out of curious, Is that how it was designed? After interfaces connected, the service need to be restarted?


if you use some wrapper script for your webserver, you can make it wait until the ressource you want to access is available … here is an example …

Instead of wrapping your service in a script, you can also implement an interface hook that runs when that interface is connected. Within that hook, you can make sure your service is restarted with snapctl restart <snapname>.<servicename>.

ah, yeah, sorry, that snap above pre-dates the existence of interface-hooks :slight_smile:

@ogra @kyrofa Thank you guys. I tried the interface hook for restarting service and it works :slight_smile:

1 Like