[systemd-devel] transforming Iptables bash script to systemd service file -help
Lennart Poettering
lennart at poettering.net
Tue Oct 21 12:30:23 PDT 2014
On Fri, 12.09.14 13:04, lux-integ (lux-integ at btconnect.com) wrote:
> On Friday 12 September 2014 11:53:23 Simon McVittie wrote:
> > The way to do this is to write a script in the programming language of
> > your choice (bash is one possibility), and have the systemd service file
> > run that. There would be little point in systemd reinventing a generic
> > script interpreter: we already have lots of those (bash, Python, etc.)
>
> thanks to you and others
> I only ask as I was under the impression that bash scripting was a no-no for
> systemd implementations
To make this clear: while be deemphasize the use of shell in the boot
process by no means it's forbidden. Absolutely not.
If you need a shell, use a shell, systemd's unit files are explicitly
not one, and shall not replace one.
For most services a shell is pretty unnecessary, and in those cases it
is great to get rid of it. But in cases like the iptables tool (which
is written in a style that kinda requires the usage of shell scripts
to invoke it, since it is more a programming language and is seldom
called just once at boot), do make use them.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list