jkorell/iperf

'daemon' mode for the server

Closed this issue · 8 comments


Server flag to fork a daemon and exit.


Original issue reported on code.google.com by bltier...@es.net on 10 Nov 2013 at 5:14

(The flag already exists but doesn't do anything. Implementing it should just 
take a sec.)

Original comment by jef.posk...@gmail.com on 10 Nov 2013 at 5:25

Should daemon mode send stdout/stderr to /dev/null?

Original comment by jef.posk...@gmail.com on 10 Nov 2013 at 10:59

Sending either stdout or stderr or both into syslog is another possibility. Now 
that all output goes through iprintf it would not be too hard. Have to add an 
ifprintf for stderr.

Original comment by jef.posk...@gmail.com on 11 Nov 2013 at 9:05

I'll handle this one.

Original comment by bmah@es.net on 26 Nov 2013 at 9:26

  • Changed state: Accepted
Actually daemonizing is easy, and I have that working now but not committed 
yet.  If it's OK to send stdout and stderr to /dev/null then I can basically 
just ship what I've got now.

Another thing to consider is whether to write the PID in a file somewhere.  A 
lot of system daemons do this, so we can find them later when it's time to kill 
/ restart them.  Does that fit with the envisioned use case(s) for daemon mode?

Original comment by bmah@es.net on 26 Nov 2013 at 9:40

I think sending it to syslog is the 'right' way to do it, but what do you 
think? /dev/null is probably fine for now, and we'll see if someone submits 
that as a 'feature request'.

Again, that would be the proper way to do it for a daemon.  Yes, that fits the 
envisioned use, tho now that you've headed down this path, I guess we need a 
boot script too?

Original comment by bltier...@es.net on 26 Nov 2013 at 9:47

OK on sending output to /dev/null for now.

I've got most of pidfile support sketched out, although it's common for daemons 
to clean up their own pidfiles when they exit.  I'm not sure how to make iperf3 
do that in a non-hacky way...need to study the different ways that the server 
process can exit.

Boot scripts are very OS-dependent (and distro-dependent).  If I were to write 
something for CentOS (for example) it wouldn't work on FreeBSD.  Just food for 
thought.

Original comment by bmah@es.net on 26 Nov 2013 at 11:43

Committed code and documentation changes for --daemon mode in changesets 
4a9b814c16e6 and 6ad958efe890.

I'm going to open other issues for the pidfile and logging changes.

Original comment by bmah@es.net on 2 Dec 2013 at 5:49

  • Changed state: Fixed