daemonspawn
spawn daemon processes, check their status, and kill them
js usage
var daemon =
var proc = daemon.spawn(cmd, opts)
spawns a daemonized process by spawning cmd
with opts
using npm-execspawn, which has the same interface as child_process.spawn
returns proc
, the child process. you need to remember proc.pid
in order to use the other methods, usually people save it to a file, but any method will work.
daemon.status(pid, cb)
checks if pid
is running, calls cb with (error, running)
where running
is a boolean
daemon.kill(pid, cb)
SIGKILL
s the pid
, calls cb
with (err)
cli usage
$ npm i daemonspawn -g $ daemonspawnUsage: daemonspawn <spawn,status,kill> [args..] spawn spawns a daemon, prints pid to stdoutstatus given a pid of a daemon, checks