I’ve been trying to think of a good way to start the exim greylistd which does not by default run in the background.
I remember reading about daemonize long ago and found it again via Google. I checked if my FreeBSD machines has this command and stumbled on daemon(8).
It was introduced around FreeBSD 4.7 and supports running any command in the background complete with pid file support.
I put the following command in a simple rc script so now I have a full start, stop, restart style command for greylistd.
/usr/sbin/daemon -cf -p /var/run/greylistd.pid /usr/local/sbin/greylistd