From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 66FF3138A87 for ; Wed, 25 Feb 2015 18:25:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1A784E098E; Wed, 25 Feb 2015 18:25:18 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4099BE0972 for ; Wed, 25 Feb 2015 18:25:17 +0000 (UTC) Received: from marcec.fritz.box ([93.181.44.4]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0M51eM-1Xadj52lHK-00zDXZ for ; Wed, 25 Feb 2015 19:25:13 +0100 Date: Wed, 25 Feb 2015 19:25:08 +0100 From: Marc Joliet To: gentoo-amd64@lists.gentoo.org Subject: Re: [gentoo-amd64] Systemd migration: opinion and questions Message-ID: <20150225192508.30cb175a@marcec.fritz.box> In-Reply-To: References: <20150224211545.50495cc0@marcec.fritz.box> <20150225085035.4618f4cd@marcec.fritz.box> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-amd64@lists.gentoo.org Reply-to: gentoo-amd64@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/zmDQ8o2e7hU4Pi0IINLG+2Z"; protocol="application/pgp-signature" X-Provags-ID: V03:K0:/WwY9Gr+hobIxqH7xsEnW8lneDaXz3s6uugbeyaOBsQ7aKd0FrY xzI6ESa1UVGtoI6TvUst9VapeyamBaWLAnN+qqglp4dzJ7c/GqLfIAKK+TT6wFx7lB41nVA f36oLnSk8T/T9RlKIqxAgddNClCPArvmiV8NskKvzQaw6eyRNiTCSoIPv+nqQA2lXvSx540 V1drxkpQNdLd6jCok+Xfg== X-UI-Out-Filterresults: notjunk:1; X-Archives-Salt: cd4d4653-bec5-4db0-8a31-45505ad2364a X-Archives-Hash: 950ecc6c805e306cdfd046c6da0c8593 --Sig_/zmDQ8o2e7hU4Pi0IINLG+2Z Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Am Wed, 25 Feb 2015 07:01:59 -0500 schrieb Rich Freeman : > On Wed, Feb 25, 2015 at 2:50 AM, Marc Joliet wrote: > > Am Tue, 24 Feb 2015 16:44:59 -0500 > > schrieb Rich Freeman : > > > >> > =3D=3D=3D Timers =3D=3D=3D > >> > > >> > Can a systemd timer depend on a mount point such that it waits until= the mount > >> > point exists before running? Or will it fail after a timeout? I wa= nt to > >> > research this myself, but haven't gotten around to it yet. > >> > >> So, timer units are units, and units can have dependencies, and mounts > >> can be dependencies since mounts are units. However, if you set the > >> dependency on the timer itself, then the timer won't start running > >> until the mount exists. You probably want the depencency to be on the > >> service started by the timer (so the timer is watching the clock, but > >> the service won't start without the mount). > > > > Wait, so the timer won't start watching the clock until its dependencie= s are > > met (i.e, the mount point appears)? Is that what you mean? Because th= at might > > be more in line with what I want (though I'm not sure yet). >=20 > If you set the dependency on the timer, then the timer doesn't start > watching the clock until they're met. If you set the dependency on > the service started by the timer then it will watch the clock but not > launch the service if the dependency isn't met. You can set the > dependency in either or both places. The timer and the service are > both units. OK, I think I got it. > > > >> If you set a > >> Requires=3Dfoo.mount and After=3Dfoo.mount, then the service shouldn't= run > >> unless foo.mount is available. I suspect systemd will attempt to > >> mount the filesystem when it runs the service, and you'll get units in > >> the failed state if that doesn't work. > >> > >> However, I haven't tested any of this. I suspect it wouldn't take > >> much to work this out. I have a mount dependency in one of my > >> services. Just look at the mount units in /run/systemd/generator for > >> the name of the mount unit systemd is creating from fstab. > > > > Right, so IIUC, I would have a oneshot service that does the backup, an= d the timer > > runs that, and of course the timer can depend on the mount point. And = if the > > mount point doesn't exist, then the service started by the timer will f= ail. > > > > What I would prefer to have is a timer that only runs if *both* the tim= e *and* > > mount conditions are met. Skimming the man page, this does not seem po= ssible. > > I suppose it would be nice if timers learned "conditions" on which they= should > > wait in addition to the time condition, but maybe that's outside the sc= ope of > > systemd? >=20 > I think if you just set the dependency on the service you'll get the > behavior you desire. Systemd will try to mount the backup filesystem, > and if that fails it won't run the backup. >=20 > You can set conditions on units as well, like only running if they're > on AC power or on amd64 or to run one unit the first time you start a > service and a different unit every other time. Some of that was > designed to implement some of the stateless system features they're > adding to systemd. Right, I'll have a look at them. Thanks --=20 Marc Joliet -- "People who think they know everything really annoy those of us who know we don't" - Bjarne Stroustrup --Sig_/zmDQ8o2e7hU4Pi0IINLG+2Z Content-Type: application/pgp-signature Content-Description: Digitale Signatur von OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJU7hOEAAoJEL/Q5oYsiHj0jK4P/RR59a9/A4nUQJpatwjMWUoi 2QG5W6/LBz5Fm6Dsi24MhDn0DiQuG7kDgQkh97zRlUiuxLXMptOydWefWE70A6L7 REpP/J3IOBIRBZrq2fsy11vgtmEiXg1aq0YRqeMLUwxp8QTWafk/U8aaME7p+C1z hDfHFtPjP4SxYBACQmHpSVEzBqyRaMOn0QcqfwuXLWVhaYHsP/RDdsm6At1SaWtT 268c/3z6RuSxnGG1fXE34depUdPChDbAPDGExyF9uz//RKzeKMlYLrySLXgo6KNp +IlFPiv1b8n3rf8VnZgymNg8e5jh8nIrMfoA5DBtLEofw1EBjh14G8nev89gGhOO 652FR4S5xMgjLlvWdEoEjwAhjVlrt0goB2E2oA0U8X0C6Xh/fnJWarXO+OLoE5Yf EqJfL25mfiFjBABBQtEcbGMudXmZQJ2ZkwKD8G9MQ0n6jHMGdYae33DtrZTgvVWf 08s0hN/F3kkk4FEiuxBRV/UtVsq6hujf8qZim6qtx8oRFErSr0AukMOiNspOerzg 5CwG4ZOEi6TvGMaRwOgEnoCn6xkRQhepZZerSXS/JlFHUqdfcsyNF9Dghs9+lg3V QHMDjOmb91IMbvGmN1sIuTMx5FE3iJaaOoyRxmIDATmFRT7foe16miZzZrETVKJ1 1IIMa+y+vBlmJjLoY/GM =KgZ6 -----END PGP SIGNATURE----- --Sig_/zmDQ8o2e7hU4Pi0IINLG+2Z--