Am 17.08.2014 05:51, schrieb Ludovico Cavedon: > Hi, > > I am writing a systemd service file for a daemon (ntopng) and I would > like to know what you think is the best way to load some > configuration. > > The ntopng daemon takes multiple interfaces in the format of multiple > -i command-line options. For example. > ntopng -i eth0 -i wlan0 > > Currently the interfaces are stored in /etc/default/ntopng > INTERFACES="eth0 wlan0" > > and the sysv init script takes care of adding "-i" for each one of them. > > I would like to keep the sysv compatibility and do the same in systemd. > > I tried in various ways, but the two solution I could think of are: > 1) change the format of INTERFACES to require inclusion of -i. > I.e > INTERFACES="-i eth0 -i wlan0" > and use EnvironmentFIle=/etc/default/ntopng. > 2) instead of doing Exec=ntopng, Exec a script that does the mangling > and then execs ntopng. > This changes the format, > complicated upgrades, and is more error prone. > Because both solutions do not look great to me, and I could not find > an example, I am asking your opinion. > > After writing this email, I start to believe 2) is the right way, but > I would appreciate anybody's input.
If you go with any of these options, I think 1) would be the better approach since this would be a one-time migration. I see that you also have a HTTP_PORT=3000 parameter in /etc/default/ntopng and a ADD_ARGS="" I'd rewrite your default file and simply pass the -w and -i parameters directly via ADD_ARGS=. Doing that as part of the postinst doesn't seem that complicated or error prone. I also happen to notice, that you use a ENABLED=1 flag. It would be a good idea to deprecate that as well and remove that. We have better mechanisms nowadays to enable/disable SysV init scripts (and systemd service files). -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?
signature.asc
Description: OpenPGP digital signature