Share

igmpproxy

Tracker: Feature Requests

5 Daemonization possibilities - ID: 2881588
Last Update: Comment added ( lly )

Please include daemonization possibilities to new versions. I'd like to
start igmpproxy from rc.local scripts at system startup.


Nobody/Anonymous ( nobody ) - 2009-10-19 08:10

5

Open

None

Nobody/Anonymous

None

None

Public


Comment ( 1 )




Date: 2009-10-20 07:45
Sender: lly

I can provide daemonize patch used myself:

diff -urBp igmpproxy.orig/src/igmpproxy.c igmpproxy/src/igmpproxy.c
--- igmpproxy.orig/src/igmpproxy.c 2009-09-15 19:25:13.000000000 +0400
+++ igmpproxy/src/igmpproxy.c 2009-09-15 19:56:19.000000000 +0400
@@ -126,6 +126,20 @@ int main( int ArgCn, char *ArgVc[] ) {
break;
}

+ if ( !Log2Stderr ) {
+
+ // Only daemon goes past this line...
+ if (fork()) exit(0);
+
+ // Detach daemon from terminal
+ if ( close( 0 ) < 0 || close( 1 ) < 0 || close( 2 ) < 0
+ || open( "/dev/null", 0 ) != 0 || dup2( 0, 1 ) < 0 || dup2( 0, 2 ) < 0
+ || setpgrp() < 0
+ ) {
+ my_log( LOG_ERR, errno, "failed to detach daemon" );
+ }
+ }
+
// Go to the main loop.
igmpProxyRun();




Log in to comment.

Attached File

No Files Currently Attached

Change

No changes have been made to this artifact.