daemon(8)

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

2 Comments

Does nohup behave differently from daemon?

Yes, nohub just makes it ignore the -HUP signal in kills and redirects any output to nohup.out.

Daemon supports changing directory to / (to prevent the daemon from holding mounted volumes) and it completely discard output by sending it to /dev/null. It also supports writing of pid files, great for stopping processes.

Leave a comment

Recent Entries

  • flashpolicyd 2.0

    I wrote a multi threaded server for Adobe Flash Policy requests, some background from Adobe:Since policy files were first introduced, Flash Player has recognized /crossdomain.xml...

  • Adventures with Ruby

    Some more about my continuing experiences with ruby, in my last post I saidthe language does what you'd expect and as you'll see in my...

  • New programming language of choice - Ruby

    I have fallen out of love with Perl some time ago, I cannot point to one specific thing about it that put me off, I...

  • On working from home

    I've not been posting much here, work has been incredibly manic the last while, especially I need to still finish off my SSO posts with...

  • Rework of puppet facts for /etc/facts.txt

    Previously I blogged a custom fact that reads /etc/facts.txt to build up some custom facts for use in Puppet manifests, well I've since learned a...

Close