W dniu sob, 30.09.2017 o godzinie 00∶20 -0400, użytkownik Walter Dnes napisał: > 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? >
You forgot the huge mapping between different service names. Then complex mapping from services that are split/merged. Next we need a tool that will update conf.d for OpenRC services which are split in systemd, to allow people controlling them independently. -- Best regards, Michał Górny
