Gentoo Archives: gentoo-amd64

From: Marc Joliet <marcec@×××.de>
To: gentoo-amd64@l.g.o
Subject: Re: [gentoo-amd64] Re: Systemd migration: opinion and questions
Date: Sat, 14 Mar 2015 14:01:54
Message-Id: 20150314150143.67c9a316@marcec.fritz.box
In Reply to: [gentoo-amd64] Re: Systemd migration: opinion and questions by Duncan <1i5t5.duncan@cox.net>
1 Am Mon, 2 Mar 2015 05:13:26 +0000 (UTC)
2 schrieb Duncan <1i5t5.duncan@×××.net>:
3
4 > Rich Freeman posted on Sun, 01 Mar 2015 14:13:53 -0500 as excerpted:
5 >
6 > > On Sun, Mar 1, 2015 at 1:20 PM, Marc Joliet <marcec@×××.de> wrote:
7 > >>
8 > >> Regardless: thoughts?
9 > >
10 > > I'd probably just do this:
11 > >> Am Sun, 1 Mar 2015 08:34:19 -0500 schrieb Rich Freeman
12 > >> <rich0@g.o>:
13 > >>>
14 > >>> The timer keeps running if you set the dependency on the service. So,
15 > >>> next time the timer runs, it will try again. You might want to just
16 > >>> set an hourly job and have it check for a successful run in the last
17 > >>> day or whatever.
18 > >>>
19 > > You could of course trigger this from either the mount or hourly.
20 > > Anytime you mount the drive or every hour systemd will run the service,
21 > > and the service will see if it managed to do a backup/etc in the last
22 > > day/week/whatever, and then run if appropriate.
23 >
24 > This is actually how I setup several former cron-jobs as systemd timers,
25 > here, based on an hourly check somewhat similar to what most crons
26 > (including gentoo's for over 10 years now and mandrake's before that) are
27 > actually setup to do to get around the fact that cron won't on-its-own
28 > trigger after restart if the machine was down or cron not running when
29 > the configured time for a job ran.
30 >
31 > Here's how I have it setup here. Note that my initials are jed, and I
32 > use them regularly as a prefix/suffix to denote custom configs (here,
33 > systemd units) I've created myself, as opposed to those shipped in
34 > whatever package.
35 >
36 [GIGASNIP thorough explanation ;) ]
37
38 I pretty much thought that's what Rich was alluding to, but thanks for showing
39 that it's not *that* much extra complication (and how one can use a target unit
40 for this). I never really looked at how these things are done by run-crons (and
41 similar).
42
43 Just for completeness: I use fcron instead of vixie-cron, so some of the stuff
44 systemd timers can do was already known to me. For example, in fcron, lines
45 can start with "@" to denote that they run relative to system startup (e.g, "@
46 5" for "every five minutes after boot). The "first" option specifies how long
47 to wait before starting an entry for the first time, analogous to "OnBootSec".
48
49 Anyway, like I mentioned before, I'll revisit this once I've solved the HDD
50 problem (or not, if it turns out to be a firmware issue).
51
52 Greetings
53 --
54 Marc Joliet
55 --
56 "People who think they know everything really annoy those of us who know we
57 don't" - Bjarne Stroustrup