Gentoo Archives: gentoo-user

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

Replies

Subject Author
Re: [gentoo-user] looking for a couple of systemd units "Canek Peláez Valdés" <caneko@×××××.com>