6

I'm running a node.js service (statsd) on CentOS 6. What's the proper way to daemonize and start such a service?

Potential Daemonizers--are daemonizers supposed to be language-specific or general?:

Service starters--should these be from the system/distro, or should they be from monitoring tools such as monit?:

I'm unfortunately new to this--where can I read up on what is the most standard, classic, reliable way of doing this?

elliot42
  • 185
  • 6

1 Answers1

3

Should the app itself really know how to daemonize itself...

If your app is meant to be run as a daemon, yes, it should be fully aware of how to daemonize itself, write the appropriate files (log and PID spring to mind), and handle signal. Big WTF if this isn't the case.

If your app isn't really meant to be daemonized, or that's not it's primiary purpose, then it's your decision completely. If you want to make it easy for others, you'll probably add it. If you want to make life easier on yourself, you'll probably leave it out. People generally wont have a "WTF" response either way.

Service starters...

Each distro's packages/ports system should be responsible for modifying your generic start/stop scripts to meet their particular needs. This stuff generally ain't rocket science, but when in doubt contact the maintainers for the distro you're working on.

Monitoring tools..

Should know how to interact with the Distro's official start/stop mechanisms, and should have no idea how to interact with your program specifically (unless your program "publishes" data through a reporting mechanism, possibly including hooks for a SNMP service or similar; all this really depends on what your program does though).

Chris S
  • 77,337
  • 11
  • 120
  • 212