From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1S9Bpb-0003wD-Dh for garchives@archives.gentoo.org; Sun, 18 Mar 2012 08:51:15 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 19408E0B3B; Sun, 18 Mar 2012 08:50:57 +0000 (UTC) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) by pigeon.gentoo.org (Postfix) with ESMTP id 23970E0AE6 for ; Sun, 18 Mar 2012 08:49:56 +0000 (UTC) Received: by werm13 with SMTP id m13so6005900wer.40 for ; Sun, 18 Mar 2012 01:49:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=Pzp/7eZx+37v2yWwURlhPGazeVZGJlP1OlEMsUtbkcI=; b=yiZi/L6ydajWAvsFJk3P5dX2GDdR1Ta9Y6yKuBMSYcbu1SmKKXLR4zkUgcms3P8NNl cR0aqFFAB8lbztqLQkhLgN0RTIlNXyb3hAZO3mRmzHXwq29ZaBBb+74ehqAWE6dElzfQ xnWSWNXc9fhS5BiGyBvPilrnGgo39WJzbPPeHlwD1QqEMRAJWFsWnWJdoe/bIB35Qqzf erSZzOYV5c7hZtEcX33IFKap1rUDeBn9VAUXKWqAdBfptYtCxSZJEvoLaW8QQRtKQp4u DsIG32zQOfI9AvNLFPmVSQhJ2+vRfesl6HmIn2TeqkVMxkNi+o4WxnqzbyNFAh4d+4Zr 4IBw== Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.180.73.143 with SMTP id l15mr11126988wiv.11.1332060596276; Sun, 18 Mar 2012 01:49:56 -0700 (PDT) Received: by 10.216.170.211 with HTTP; Sun, 18 Mar 2012 01:49:56 -0700 (PDT) In-Reply-To: <87obrugwvn.fsf@newton.gmurray.org.uk> References: <709768995.843751.1331957483491.JavaMail.open-xchange@email.1and1.com> <20120317115300.GB3615@acm.acm> <87obrugwvn.fsf@newton.gmurray.org.uk> Date: Sun, 18 Mar 2012 02:49:56 -0600 Message-ID: Subject: Re: [gentoo-user] Re: systemd? [ Was: The End Is Near ... ] From: =?UTF-8?B?Q2FuZWsgUGVsw6FleiBWYWxkw6lz?= To: gentoo-user@lists.gentoo.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Archives-Salt: a88a7fbc-1281-4fea-8a98-432b8b7b818b X-Archives-Hash: 43d0cbff0cfcc813d198a92b594f651d On Sun, Mar 18, 2012 at 2:02 AM, Graham Murray wrot= e: > Canek Pel=C3=A1ez Vald=C3=A9s writes: > >> * Really simple service unit files: The service unit files are really >> small, really simple, really easy to understand/modify. Compare the 9 >> lines of sshd.service: >> >> $ cat /etc/systemd/system/sshd.service >> [Unit] >> Description=3DSSH Secure Shell Service >> After=3Dsyslog.target >> >> [Service] >> ExecStart=3D/usr/sbin/sshd -D >> >> [Install] >> WantedBy=3Dmulti-user.target >> >> with the 84 of /etc/init.d/sshd (80 without comments). > > But the 80 lines of /etc/init.d/sshd =C2=A0do a lot more than just and st= op > the service. Yes, it does. > They ensure that there is an sshd configuration file and > give a meaningful message (including where to find the sample) if it is > not present, and check for the presence of the hostkeys (again which are > needed) and create them if they are not present. Your 9 lines of > sshd.service do none of this. That is completely true. I also think that those checks does not belong into the init script: I think the configuration file presence should be guarantee by the package manager at install time, and so the creation of the hostkeys. Having said that, systemd provides ConditionPathExists, which allows you to set a file as necessary for a service execution. So my 9 lines transform into $ cat /etc/systemd/system/sshd.service [Unit] Description=3DSSH Secure Shell Service After=3Dsyslog.target ConditionPathExists=3D/etc/ssh/sshd_config [Service] ExecStart=3D/usr/sbin/sshd -D [Install] WantedBy=3Dmulti-user.target If the config file doesn't exists, the service will not start, and you can check the reason why with systemctl status sshd.service And of course you can set another mini sevice unit file to create the hostkeys. But I repeat: I think those tasks belong into the package manager, no the init script. Regards. --=20 Canek Pel=C3=A1ez Vald=C3=A9s Posgrado en Ciencia e Ingenier=C3=ADa de la Computaci=C3=B3n Universidad Nacional Aut=C3=B3noma de M=C3=A9xico