On 08/17/2014 11:51 AM, Ludovico Cavedon wrote: > 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. This changes the format, > complicated upgrades, and is more error prone. > 2) instead of doing Exec=ntopng, Exec a script that does the mangling > and then execs ntopng. > > 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. > > Thanks, > Ludovico
Hi, I had the same problem as you describe above, even a bit more complicated because, in what we did, /etc/default/<file> sometimes doesn't exist (it's not mandatory in what we did). We finally ended-up using a wrapper script, and I'm not satisfied by the current implementation (which re-use the sysv-rc forking script, which is IMO ugly). Folks from the systemd list have been helpful and provided advices, but it doesn't address the problem in the way I wished. > 3) Teach ntopng to understand /etc/ntopng.conf natively and migrate > the settings there. > 4) Teach ntopng to automatically detect the available network devices > on the system (including new ones that show up dynamically) and > automatically handle all of them unless configured to do otherwise, > making configuration usually unnecessary. > > - Josh Triplett How about teaching systemd that script is sometimes necessary? It's annoying to write a wrapper, because then, it does a fork to start the daemon, so the PID changes. Has this been reported upstream? If yes, what's upstream opinion about it? I think this would be a really good improvement to systemd. Cheers, Thomas Goirand (zigo) P.S: This is *not* the start of a troll thread, please stay on-topic, and discuss *only* the technical issue about using default file in .service files, otherwise go open a *new* yet-another-systemd-troll-thread. -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/53f07808.90...@debian.org