Skip to content

Latest commit

 

History

History
147 lines (104 loc) · 2.84 KB

processes.md

File metadata and controls

147 lines (104 loc) · 2.84 KB

Help

  1. Starting and stopping processes
  2. Controlling the Daemon
  3. Managing clusters
  4. Installing and running apps
  5. Remote access and monitoring (e.g. guv-web)
  6. Web interface
  7. Web interface - configuration
  8. Web interface - user management
  9. Programmatic access
  10. Programmatic access - local
  11. Programmatic access - remote
  12. Programmatic access - events

Starting and stopping processes

  1. start
  2. restart
  3. stop
  4. list
  5. heapdump
  6. gc
  7. signal
  8. send
  9. write

start

guv start [options] <script>

Start a new process.

args

-h, --help                   output usage information
-u, --user <user>            The user to start a process as
-g, --group <group>          The group to start a process as
-i, --instances <instances>  How many instances of the process to start (e.g. cluster mode)
-n, --name <name>            What name to give the process
-a, --argv <argv>            A space separated list of arguments to pass to a process
-e, --execArgv <execArgv>    A space separated list of arguments to pass to the node executable
-d, --debug                  Pause the process at the start of execution and wait for a debugger to be attached
-v, --verbose                Prints detailed internal logging output

e.g.

To start http-server.js as a cluster with two workers, running as alex:staff and with two command line arguments -a foo and -b bar

$ guv start -u alex -g staff -i 2 -argv '-a foo -b bar' http-server.js

restart

Restart a running process

guv restart <pid>

stop

Stop a running process.

guv stop <pid>

list

guv list

Display a list of processes guvnor has started.

send

Send an event to a process

guv send <pid> <event> [args...]

e.g.

In my script

process.on('my:custom:event', function(arg1, arg2) {
  console.info(arg1 + arg2)
})
$ guv send 39823 my:custom:event 1 2
// process 39823 then prints '3' to the logs

heapdump

Make a process dump a heap snapshot for analysis in Chrome's debug tools. The file will appear at process.cwd

guv heapdump <pid>

gc

Force a process to do garbage collection

guv gc <pid>

signal

Send a signal to a process (n.b. unless you have a listener for that signal, your process will most likely exit)

guv signal <pid> <signal>

e.g.

$ guv signal 3984 SIGINT

write

Writes a string to the stdin of your process

guv write <pid> <string>

e.g.

$ guv write 3984 'hello world'