[gentoo-user] systemd and local equivalent

2013-08-15 Thread covici
Hi.  I would like to be able to have an equivalent of /etc/local.d/
something to execute those commands which do not fit neatly into the
boot scheme -- for instance I  have several things which have something
in init.d and I just have to say /etc/init.d/thing start after
everything is up.  There are other miscellaneous commands I need to
issue, so how can I do this using systemd?

Thanks in advance for any suggestions.

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

 John Covici
 cov...@ccs.covici.com



Re: [gentoo-user] systemd and local equivalent

2013-08-15 Thread Mark Pariente
On Thu, 2013-08-15 at 17:41 -0400, cov...@ccs.covici.com wrote:
 Hi.  I would like to be able to have an equivalent of /etc/local.d/
 something to execute those commands which do not fit neatly into the
 boot scheme -- for instance I  have several things which have something
 in init.d and I just have to say /etc/init.d/thing start after
 everything is up.  There are other miscellaneous commands I need to
 issue, so how can I do this using systemd?
 
 Thanks in advance for any suggestions.
 

You could write a simple unit file /etc/systemd/system/my-stuff.service:

[Unit]
Description=My Stuff

[Service]
Type=oneshot
ExecStart=/../my-script --start
ExecStop=/../my-script --stop

[Install]
WantedBy=multi-user.target

And then enable this service with:
systemctl enable my-stuff.service

Please note you might need to add some dependencies (for example if you
need networking etc.) to make sure everything your script needs is ready
to use.

--Mark