sudonym1 / iperf

Automatically exported from code.google.com/p/iperf
Other
0 stars 0 forks source link

'daemon' mode for the server #105

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

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

GoogleCodeExporter commented 9 years ago
(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

GoogleCodeExporter commented 9 years ago
Should daemon mode send stdout/stderr to /dev/null?

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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
I'll handle this one.

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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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