How to start a service app ?

Jamie Strandboge jamie at canonical.com
Thu Apr 2 14:13:17 UTC 2015


On 04/01/2015 07:43 PM, Mike Cornelius wrote:
> Having now managed to install some snapps on my system I'm once again
> stuck on something which must be pretty simple.
> 
> What is the correct way to start an installed service snapp (eg. webdm)?
> 
> 'service webdm start' gives me:-
> 
>  ubuntu at localhost:~$ service webdm start
>  webdm: unrecognized service
> 
> 
> I can start webdm using the following command from the console:-
> 
>  /apps/webdm/current/snappyd
> 
> But I'm sure that's not correct.
> 

Snappy uses systemd so stopping and starting services needs to use systemctl. Eg:

$ systemctl list-units --no-pager | grep webdm  webdm_avahi_0.1.service
                                                         loaded active running
 Avahi daemon
  webdm_snappyd_0.1.service
           loaded active running   Snappy WebDM

$ systemctl status webdm_snappyd_0.1.service

$ sudo systemctl stop webdm_snappyd_0.1.service   # needs sudo

$ sudo systemctl start webdm_snappyd_0.1.service  # needs sudo


Service files are in /etc/systemd/system. Eg:
$ cat /etc/systemd/system/webdm_snappyd_0.1.service
[Unit]
Description=Snappy WebDM
After=apparmor.service click-system-hooks.service
Requires=apparmor.service click-system-hooks.service
X-Snappy=yes

[Service]
ExecStart=/apps/webdm/0.1/snappyd
WorkingDirectory=/apps/webdm/0.1
Environment="SNAPP_APP_PATH=/apps/webdm/0.1"
"SNAPP_APP_DATA_PATH=/var/lib/apps/webdm/0.1"
"SNAPP_APP_USER_DATA_PATH=%h/apps/webdm/0.1" "SNAP_APP_PATH=/apps/webdm/0.1"
"SNAP_APP_DATA_PATH=/var/lib/apps/webdm/0.1"
"SNAP_APP_USER_DATA_PATH=%h/apps/webdm/0.1" "SNAP_APP=webdm_snappyd_0.1"
AppArmorProfile=webdm_snappyd_0.1

[Install]
WantedBy=multi-user.target


Hope this helps!

-- 
Jamie Strandboge                 http://www.ubuntu.com/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/snappy-devel/attachments/20150402/818b3ae3/attachment.pgp>


More information about the snappy-devel mailing list