* Re: [gentoo-dev] Providing a `service` scripts that speaks OpenRC and systemd
@ 2017-09-30 4:20 99% ` Walter Dnes
0 siblings, 0 replies; 1+ results
From: Walter Dnes @ 2017-09-30 4:20 UTC (permalink / raw
To: gentoo-dev
On Thu, Sep 28, 2017 at 04:27:31PM -0500, Austin English wrote
> (Note: serious discussion, please take systemd trolling elsewhere).
>
> While having the pleasure of working with some proprietary software
> recently, I was asked to run `service foo restart`, and was surprised to
> see:
> foobar ~ # service foo restart
> * service: service `foo' does not exist
Ridiculous! We need to develop one universal standard that covers
everyone's use cases. https://xkcd.com/927/
But if you insist, why not just set up a short bash script called
"service" rather than monkeying with every init system's internals?
#!/bin/bash
if [[ <condition_running_systemd> ]] ; then
systemctl ${2} ${1}
elif [[ <condition_running_initrc> ]] ; then
/etc/init.d/${1} ${2}
elif [[ <condition_running_some_other_init> ]] ; then
<do whatever that init system requires>
else
echo "ERROR: Unsupported init system; 'service' call failed"
fi
This can handle a large number of different inits, with as many "elif"
lines as you care to add. But, how do we reliably detect the currently
running init system? Are there running processes, or entries in /sys/
or /proc/ or /dev that are unique to to each init system?
--
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications
^ permalink raw reply [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2017-09-28 21:27 [gentoo-dev] Providing a `service` scripts that speaks OpenRC and systemd Austin English
2017-09-30 4:20 99% ` Walter Dnes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox