Sure with threads. Forked processes no longer require a parent. Writing all the pids is also good habit too. :)

Dan

Aaron Stone wrote:
Why would the pidfile contain all of the children? The pid should be written
before forking so it has the parent pid. Kill it, and the children go, too.

Aaron


Dan Weber <[EMAIL PROTECTED]> said:

bah "a+"


Dan Weber


Dan Weber wrote:

btw, you can't use "w" mode because that will just overwrite the pidfile since you need to have it so it stores all the forks, you need to use w+.

Dan Weber
Aaron Stone wrote:


Yes! Thanks for bring this up. I wrote my own init scripts for Mandrake and
Gentoo and the shutdown procedure is basically 'killall dbmail-blah'.

Aaron


Dan Weber <[EMAIL PROTECTED]> said:



If its a daemon it needs '-p' for pidfiles. These debian init scripts are atrocious and need to get updated with pidfiles ;) Below is a somewhat modified version of what I used in siproxd. Its not very complex, just make 'pidfile = optarg' at the 'p' option and put it in some header.


char *pidfile;
int createpidfile(char* pidfile)
{
  FILE *f = NULL;
  TRACE(TRACE_INFO,"creating PID file [%s]", pidfile);
  if ((f=fopen(pidfile, "w")))
     {
        fprintf(f,"%i\n",(int)getpid());
        fclose(f);
     }
  else
     {
TRACE(TRACE_ERROR,"couldn't create new PID file: %s", strerror(errno));
        return(1);
     }
  return(0);
}

Dan


Aaron Stone wrote:


How about this set of command line options across the board...

Common options for all DBMail utilities:
   -f file   specify an alternative config file
   -q        quietly skip interactive prompts
   -n        show the intended action but do not perform it, no to all
   -y        perform all proposed actions, as though yes to all
   -v        verbose details
   -V        show the version
   -h        show this help message

One option that I'd like to have on the command line for the daemons is a no-daemonize / no-fork option. This would be a great benefit for lots of debugging and testing situations. Would overloading the meaning of '-n' work?

Thoughts, questions, comments?

Aaron
_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://twister.fastxs.net/mailman/listinfo/dbmail-dev



--------------enigA76E70A2620D0BAB39B88C67
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFA7EZZF6i3K/AxoQERAp8hAKCvAo1x5Ka/FG5HIGHJYUdZHDuLIgCgokVZ
XjwSALw8bUZECJPFrQaD6us=
=Y1pt
-----END PGP SIGNATURE-----

--------------enigA76E70A2620D0BAB39B88C67--

--===============0984879432==






------------------------------------------------------------------------

_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://twister.fastxs.net/mailman/listinfo/dbmail-dev


--------------enig77C70C80A58D5CEEC45596DC
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFA7KknF6i3K/AxoQERAuAVAKDQSZouJXJwyitgVNvQIN1U3qTimgCgriWD
nxgtPQewM5xMsP1/wzbScvw=
=b9Dw
-----END PGP SIGNATURE-----

--------------enig77C70C80A58D5CEEC45596DC--

--===============0154159932==





Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to