daemonize nodejs
daemonize your application :P
unless process.env.__daemon
args = [].concat process.argv
args.shift()
args.shift()
process.env.__daemon = yes
child = spawn process.mainModule.filename, args,
stdio: 'ignore'
env: process.env
cwd: process.cwd()
detached: yes
child.unref()
process.exit 0
fs.writeFileSync 'app.pid', process.pid
Written by geta6
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Coffee-script
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#