Command line interface to manipulate services

While right now snaps offer a convenient way to register certain applications as daemons, we don’t yet expose a convenient way to manipulate them after installation. One needs to enable/disable the whole snap instead, which is a larger action.

So here is a quick proposal for implementing the manipulation of daemons via the snap command:

  • snap stop <snap>[.<app>] – Stops all daemons in the snap, or only the selected one if specified.
  • snap start <snap>[.<app>] – Starts all daemons in the snap, or only the selected one if specified.
  • snap restart <snap>[.<app>] – Restarts all daemons in the snap, or only the selected one if specified. Daemons which are not yet running will be started as well.
  • snap restart --reload <snap>[.<app>] – Reloads all daemons in the snap, or only the selected one if specified. Daemons that do not support reloading are restarted instead as long as they were already running (systemd’s try-reload-or-restart).
  • snap log <snap>[.<app>] – Shows logs for all daemons in the snap, or only the selected one if specified.
  • snap status <snap>[.<app>] – Shows human-oriented status summary for all daemons in the snap, or only the selected one if specified (systemd’s status).

For all commands, multiple <snap>[.<app>] parameters may be specified, but at least one must necessarily be provided.

Last updated 1 year, 4 months ago. Help improve this document in the forum.