View Single Post
Community Council | Posts: 4,920 | Thanked: 12,867 times | Joined on May 2012 @ Southerrn Finland
#14
Originally Posted by bennypr0fane View Post
Well that certainly applies not just to you, but also dozens of other Jolla users who earn their living in the IT sector, right?
Not so much to people who don't know how to code, set up a server etc., or let's just say the average smartphone user. I actually keep forgetting that the average smartphone user will also never be an Owncloud user...
Me, I'm sort of somewhere inbetween these two categories, much closer to the latter one.
So tell me, how do you "make it a service"?
Well, for starters; you can categorize applications broadly in 2 groups:
  • One kind is something that an user starts and uses. (browser, email, document-reader, ...)
  • Other kind is something that runs there "always" and users rarely know about it. (ofono, sshd, init, ...)

Fairly often there are cases that you have "both kinds work together" to make an useful functionality, for example the call recorder. It consists of 2 parts; one is a service always active and waiting for a call to happen and start recording, and the other is the user interface where you can change settings and listen to the recordings.

So. How to make an application a service? The first requirement is that it needs to run headless, meaning it should not need to display anything on the GUI nor require any direct user input when it strts and runs.
The next requirement is to launch it automatically, which on SFOS means it is started and stopped by systemd.

The details for this are usually hidden in the installation RPM package (but of course you can also do it manually)
In a simplified explanation; you create a small launcher script in /lib/systemd/system/ folder which tells what the service is and how to invoke it. There are quite a few service scripts there, you can look at them and see how they work.

The beautiful thing about packaging in linux (whether it be RPM or DEB or whatever) is that it is easy to create functionality that uses both services and UI components and it installs (and uninstalls) pretty much automatically without any need for the user to understand what happens under the hood.
 

The Following User Says Thank You to juiceme For This Useful Post: