On Sat, Feb 05, 2005 at 08:23:09PM +0100, Peter Palfrader wrote:
> I guess you really want to use pidfiles, and not go (just) by name.

I'd like it to do that too.  Unfortunately the daemon forks from it's main
process and so start-stop-daemon -m does not work.  I patched proxytest.cpp
to write a pid file, but this still doesn't work because /var/run is
root:root 755, and this daemon starts as nobody.

I'm not up for making this thing run as root and drop privs, but I guess this
is what is in order?

Also, is it really release critical that it use --pidfile ?

> Also Todd, I think everybody prefers unified diffs (-u).

Seems to be the case, thanks. *sets mode udiff*

Attaching the write-pid patch just in case someone finds it useful.

-- 
[   Todd J. Troxell                                         ,''`.
      Student, Debian GNU/Linux Developer, SysAdmin, Geek  : :' :
      http://debian.org || http://rapidpacket.com/~xtat    `. `' 
                                                             `-     ]
--- anon-proxy-00.02.39.orig/proxytest.cpp
+++ anon-proxy-00.02.39/proxytest.cpp
@@ -62,6 +62,9 @@
        #include "CAFirstMixNewProtocol.hpp"
        #include "CALastMixNewProtocol.hpp"
 #endif
+
+#define PIDFILE "/var/run/proxytest.pid"
+
 //#include "CAPayment.hpp"
 //#ifdef _WIN32
 //HANDLE hEventThreadEnde;
@@ -367,7 +370,8 @@
 //             UINT16 timestamp;
 //             currentTimestamp((UINT8*)&timestamp);
                pMix=NULL;
-
+               // PID File
+               FILE *pf;
                int i;
                SINT32 maxFiles;
                //Setup Routines
@@ -657,6 +661,11 @@
                                        pid=fork();
                                        if(pid!=0)
                                                exit(0);
+                                       pf = fopen(PIDFILE, "w");
+                                       if (pf == NULL)
+                                               fprintf(stderr, "Unable to 
write pidfile.\n");
+                                       fprintf(pf, "%d\n", pid);
+                                       fclose(pf);
                                        setsid();
                                        #ifndef DO_TRACE
                                        chdir("/");

Attachment: signature.asc
Description: Digital signature

Reply via email to