From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 17F2E1396D0 for ; Sat, 30 Sep 2017 04:21:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AC2152BC011; Sat, 30 Sep 2017 04:21:05 +0000 (UTC) Received: from pmta31.teksavvy.com (pmta31.teksavvy.com [76.10.157.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 71AC52BC008 for ; Sat, 30 Sep 2017 04:21:05 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2GPWQDkGs9Z/87292hcHQEFAQsBg1xEI?= =?us-ascii?q?EQqJ4kGhgaOcAGCJAGXS0MdCIFmgzQEAgKEMlgBAgEBAQEBAgNoKEIMAYIWRik?= =?us-ascii?q?vAQEBAQEBAQEBAR8CKUIGOhwzCyETEg8FJTeKMahBi0MBAQgCIQWDLYJWfYUSh?= =?us-ascii?q?VCCdoIxAQSKC4kdjgcCgjCFLIx5giGFboNJGocilwlYgQ6BBQiIAiQ2gxSGQwE?= =?us-ascii?q?BAQ?= X-IPAS-Result: =?us-ascii?q?A2GPWQDkGs9Z/87292hcHQEFAQsBg1xEIEQqJ4kGhgaOcAG?= =?us-ascii?q?CJAGXS0MdCIFmgzQEAgKEMlgBAgEBAQEBAgNoKEIMAYIWRikvAQEBAQEBAQEBA?= =?us-ascii?q?R8CKUIGOhwzCyETEg8FJTeKMahBi0MBAQgCIQWDLYJWfYUShVCCdoIxAQSKC4k?= =?us-ascii?q?djgcCgjCFLIx5giGFboNJGocilwlYgQ6BBQiIAiQ2gxSGQwEBAQ?= X-IronPort-AV: E=Sophos;i="5.42,455,1500955200"; d="scan'208";a="5126764" Received: from 104-247-246-206.cpe.teksavvy.com (HELO waltdnes.org) ([104.247.246.206]) by smtp.teksavvy.com with SMTP; 30 Sep 2017 00:21:03 -0400 Received: by waltdnes.org (sSMTP sendmail emulation); Sat, 30 Sep 2017 00:20:31 -0400 From: "Walter Dnes" Date: Sat, 30 Sep 2017 00:20:31 -0400 To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] Providing a `service` scripts that speaks OpenRC and systemd Message-ID: <20170930042030.GA19714@waltdnes.org> References: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) X-Archives-Salt: 245707c5-503d-4b37-813d-ed3f0b2ae0c7 X-Archives-Hash: 4ca1ea1b4d0df53cc872cfa684573028 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 [[ ]] ; then systemctl ${2} ${1} elif [[ ]] ; then /etc/init.d/${1} ${2} elif [[ ]] ; then 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 I don't run "desktop environments"; I run useful applications