Hi Florian!
Attached is a small patch to NGIRCd CVS that writes the daemons pid to a file (Default: /var/run/ngircd/ngircd.pid).
Your approach won't work when using the REHASH command or sending the daemon a SIGHUP: ngIRCd forks a new process which possibly doesn't run with root privileges and/or chroot()'ed. The the pid-file can't be written.
A possible solution should be (untested):
in main(): - open/create pid file with before dropping privileges and remember its file handle, - unlink the file. - call Write_Pidfile() inside the main loop. - close the file before exiting.
Write_Pidfile() should truncate the pid file (ftruncate) and write the PID into it. It shouldn't open and close it.
The getpid.sh script included with ngircd does not work on FreeBSD 5.3-Stable (ps needs -ax switches).
Hm, this script is only intended to be used by the "test suite" and I thought(!) that I tested it on FreeBSD 5 ... I'll re-test it.
Also, the sample configuration file says 'one port, separated with ";"' ( the given example uses the correct "," seperator).
Thanks, fixed in CVS-HEAD.
Regards Alex