2

I would like to write a service with the standard start, stop, restart, status interface and that runs on startup and restarts if killed. However, in researching solutions, I've discovered that there are multiple ways to do this with varying levels of support, and that the latest Debian release changed its support for installing services.

What's the simplest supported way to create a service in Jessie? What's the most canonical way to create a service in Jessie? Is /etc/init.d only used for deprecated approaches?

twinlakes
  • 219
  • 1
  • 10
  • Although it does not fulfill all your criteria, you could first have a look at this. Beyond that, questions about systemd are more appropriate to our big sibling site Unix & Linux. There is copious documentation online, and also a slew of man pages (try apropos systemd; the ones most applicable will probably be systemd.unit, systemd.service, and systemd.exec as most of the directives are in those). – goldilocks Jan 13 '17 at 18:41
  • Service creation differs across Linux distributions. Asking questions specific to the latest Raspbian distro is off topic? – twinlakes Jan 14 '17 at 03:07
  • "Service creation differs across Linux distributions." -> No, service creation differs from one init system to another. Once upon a time distros were almost all essentially SysV based, and Debian has been the big holdout on this. Since Debian abandoned that w/ v.8 (jessie) and Ubuntu finished with upstart, both in favour of systemd (which began with Fedora), they are now for the most part all unified again. – goldilocks Jan 14 '17 at 09:17
  • I close questions like this partially for the benefit of the poster: It makes more sense, and you will get better results, if you research from the general to the specific rather vice versa. For example, command line utilities specified by POSIX such as ls, (man, crontab, nice, etc.) may still differ slightly from one implementation to another, but: – goldilocks Jan 14 '17 at 09:18
  • On GNU/Linux (including all the aforementioned distros), the implementation is usually the same, since it's from GNU coreutils. However, even with this, there may be minor difference due to version (which Debian lags behind on by policy) and choices made during compilation. So, indeed, it may turn that there is some peculiar quirk to the ls used on Raspbian that differentiates it from most other distros. – goldilocks Jan 14 '17 at 09:19
  • However, don't assume that there is, and therefore the POSIX documentation for ls is no good to you, because you must have the "raspberry pi docs" (or Raspbian docs). Instead assume it's the same as everywhere else and research it that way. I've used systemd on a variety of distributions and (at least in the context of what you are asking about) it is the same everywhere. Since the Raspberry Pi only represents a small percentage of linux users, this means you have a much broader range of material to draw on. – goldilocks Jan 14 '17 at 09:19
  • We do often field general linux questions here at our discretion ("our" being the community which elected me), but with most things, particularly this, you will get better advice on U&L. However, this question would likely quickly be closed as a duplicate and/or slammed as reflecting a lack of research effort, which is why I did not migrate it directly. I'm not accusing of you of laziness or blaming you for your ignorance, BTW; linux can remain a bewildering world for people even after a few years of casual use. – goldilocks Jan 14 '17 at 09:20
  • What I am trying to say is, "Hey, you've got your head stuck in the sand". The other major reason I close questions like this is to spare people having to write, e.g., an explanation of ls for Raspberry Pi users. There's no need for that and spoon feeding beyond a certain point is not a favour to anyone. Good luck -- like a lot of things linux, systemd does not have the "consumer orientation" people are used to in an operating system (it's skewed toward the "power user"), and the docs reflect this, but don't mistake that for incoherence or dysfunction. – goldilocks Jan 14 '17 at 09:20

0 Answers0