Gentoo Archives: gentoo-user

From: Mark Pariente <markpariente@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] systemd and local equivalent
Date: Fri, 16 Aug 2013 04:45:07
Message-Id: 1376628293.1883.14.camel@siegeengine
In Reply to: [gentoo-user] systemd and local equivalent by covici@ccs.covici.com
1 On Thu, 2013-08-15 at 17:41 -0400, covici@××××××××××.com wrote:
2 > Hi. I would like to be able to have an equivalent of /etc/local.d/
3 > something to execute those commands which do not fit neatly into the
4 > boot scheme -- for instance I have several things which have something
5 > in init.d and I just have to say /etc/init.d/<thing> start after
6 > everything is up. There are other miscellaneous commands I need to
7 > issue, so how can I do this using systemd?
8 >
9 > Thanks in advance for any suggestions.
10 >
11
12 You could write a simple unit file /etc/systemd/system/my-stuff.service:
13
14 [Unit]
15 Description=My Stuff
16
17 [Service]
18 Type=oneshot
19 ExecStart=/../my-script --start
20 ExecStop=/../my-script --stop
21
22 [Install]
23 WantedBy=multi-user.target
24
25 And then enable this service with:
26 systemctl enable my-stuff.service
27
28 Please note you might need to add some dependencies (for example if you
29 need networking etc.) to make sure everything your script needs is ready
30 to use.
31
32 --Mark