Gentoo Archives: gentoo-user

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] looking for a couple of systemd units
Date: Tue, 27 Aug 2013 13:58:32
Message-Id: CADPrc81k_Rzn2HuFWT-qBML-jf1jmJzLRaThnV9US4+cWeAtcQ@mail.gmail.com
In Reply to: Re: [gentoo-user] looking for a couple of systemd units by covici@ccs.covici.com
1 On Tue, Aug 27, 2013 at 2:46 AM, <covici@××××××××××.com> wrote:
2 > Canek Peláez Valdés <caneko@×××××.com> wrote:
3 >
4 >> On Tue, Aug 27, 2013 at 1:10 AM, <covici@××××××××××.com> wrote:
5 >> > Canek Peláez Valdés <caneko@×××××.com> wrote:
6 >> >
7 >> >> On Mon, Aug 26, 2013 at 11:06 PM, Canek Peláez Valdés <caneko@×××××.com> wrote:
8 >> >> > On Mon, Aug 26, 2013 at 10:52 PM, <covici@××××××××××.com> wrote:
9 >> >> >> Hi. I am looking for a couple of systemd units which I have not been
10 >> >> >> able to find -- one for mailman and one for innd which is a shell script
11 >> >> >> by itself.
12 >> >> >>
13 >> >> >> Thanks in advance for any suggestions.
14 >> >> >
15 >> >> > I use this one in production for mailman with Gentoo:
16 >> >> >
17 >> >> > ----------------------------------------------------------------
18 >> >> > [Unit]
19 >> >> > Description=Mailman mailing list service
20 >> >> > After=network.target
21 >> >> >
22 >> >> > [Service]
23 >> >> > Type=forking
24 >> >> > ExecStart=/usr/lib/mailman/bin/mailmanctl -s start
25 >> >> > ExecStop=/usr/lib/mailman/bin/mailmanctl stop
26 >> >> > User=mailman
27 >> >> > Group=mailman
28 >> >> >
29 >> >> > [Install]
30 >> >> > WantedBy=multi-user.target
31 >> >> > ----------------------------------------------------------------
32 >> >> >
33 >> >> > I don't have any for innd.
34 >> >>
35 >> >> If innd is the one from net-nntp/inn, then the following should work:
36 >> >>
37 >> >> ----------------------------------------------------------------
38 >> >> [Unit]
39 >> >> Description=The Internet News daemon
40 >> >> Documentation=man:innd(8)
41 >> >> ConditionPathExists=/var/run/news
42 >> >>
43 >> >> [Service]
44 >> >> Type=simple
45 >> >> ExecStart=/usr/lib/news/bin/rc.news
46 >> >> ExecStop=/usr/lib/news/bin/rc.news stop
47 >> >> User=news
48 >> >> Group=news
49 >> >>
50 >> >> [Install]
51 >> >> WantedBy=multi-user.target
52 >> >> ----------------------------------------------------------------
53 >> >>
54 >> >> If the binary rc.news forks itself (and there is no option to force it
55 >> >> to run in the foreground), use Type=forking. The former is preferred
56 >> >> over the latter. Also, to guarantee that the directory /var/run/news
57 >> >> always is present, add the following to a new file
58 >> >> /etc/tmpfiles.d/innd.conf:
59 >> >>
60 >> >> ----------------------------------------------------------------
61 >> >> d /var/run/news 0755 news news 10d -
62 >> >> ----------------------------------------------------------------
63 >> >>
64 >> >> You can replace 10d with - (hypen), so the directory is never cleaned
65 >> >> automatically. If you try this unit and it works as expected, please
66 >> >> let us know.
67 >> >>
68 >> >
69 >> > OK, thanks again. I have one question which this brings up -- and this
70 >> > applies to openrc as well -- I never have let it migrate /var/run to
71 >> > /run and /var/lock likewise because I have directories in those which
72 >> > are owned by various users, etc. and the packages themselves almost
73 >> > never create such -- is putting things in /etc/tmpfiles.d the correct
74 >> > way to fix this?
75 >>
76 >> tmpfiles.d is from systemd:
77 >>
78 >> http://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
79 >>
80 >> However, I think OpenRC developers were thinking about supporting it.
81 >> I don't know if that actually happened.
82 >>
83 >> With systemd in Gentoo, /var/run is bind mounted from /run, and it's a
84 >> tmpfs dir, so everything there goes away after a reboot. The config
85 >> files in tmpfiles.d allows the creation (and automatic removal) of
86 >> directories and files there.
87 >>
88 >> I don't know if it's the "correct" way to fix anything; but it works.
89 >>
90 > Can I use the d action to change the permissions of an existing
91 > directory and if not, how can I do this?
92
93 I don't think so. The contents of /run (and /var/run before it) are,
94 by definition, used only at run time. They are not intended to be
95 preserved, and they actually should be cleaned from time to time
96 (hence the age field in tmpfiles.d). Therefore tmpfiles.d only deals
97 with creation (and cleaning up) of files/directories, not "updating"
98 them, since they should not be even present when the system boots up.
99
100 The files in /etc/tmpfiles.d are used by the systemd-tmpfiles-* units,
101 and (AFAIU) they only create files/directories at boot time, and then
102 only clean afterwards.
103
104 My /run directory is really empty. When my systems boot up, systemd
105 mounts a tmpfs on it:
106
107 # mount | grep "on /run"
108 tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
109
110 Then the var-run.mount unit binds mount /run into /var/run. So no
111 file/directory there is actually written into any physical disk ever.
112
113 Regards.
114 --
115 Canek Peláez Valdés
116 Posgrado en Ciencia e Ingeniería de la Computación
117 Universidad Nacional Autónoma de México

Replies

Subject Author
Re: [gentoo-user] looking for a couple of systemd units covici@××××××××××.com