inex/IXP-Manager — pull request #113 by rowanthorpe (2013-12-12 12:45:19+00:00)
Title: Improve mrtg init file

Three commits. Third commit is more cosmetic/less important. The git-branch name is improve_mrtg_conf - it should say improve_mrtg_init, but it will take me a while to change that so I'll leave it...

--

(commit 1/3)
Put --daemon in mrtg initfile (diff/t semantics than in conf)

[as explained in the MRTG manpage]...

```
--daemon
Put MRTG into the background, running as a daemon. This works the same
way as the config file option, but the switch is required for proper
FHS operation (because /var/run is writable only by root)
```
...and the init file should *always* spawn mrtg as a daemon anyway if at
all possible (otherwise init needs to brute-force backgrounding it after
the fact, which is advised against in start-stop-daemon manpage on Debian,
and probably applies in other init systems too).

(commit 2/3)
Put --pid-file in mrtg init daemonargs (always needed)

Explicitly set mrtg flag --pid-file=$PIDFILE in init file because (being
init) pid file is *always* needed, and is already hard-coded there for
the stop() command. This avoids code-duplication in the config file, and
consequent possibility for mismatches (resulting in non-killed mrtg
processes). Set PIDFILE *before* referencing it (reorder setting of
vars).

(commit 3/3)
Make setting and use of vars in init-file more DRY