UNPKG

3.51 kBMarkdownView Raw
1# node-supervisor
2
3A little supervisor script for nodejs. It runs your program, and
4watches for code changes, so you can have hot-code reloading-ish
5behavior, without worrying about memory leaks and making sure you
6clean up all the inter-module references, and without a whole new
7`require` system.
8
9## node-supervisor -?
10
11
12 Node Supervisor is used to restart programs when they crash.
13 It can also be used to restart programs when a *.js file changes.
14
15 Usage:
16 supervisor [options] <program>
17 supervisor [options] -- <program> [args ...]
18
19 Required:
20 <program>
21 The program to run.
22
23 Options:
24 -w|--watch <watchItems>
25 A comma-delimited list of folders or js files to watch for changes.
26 When a change to a js file occurs, reload the program
27 Default is '.'
28
29 -i|--ignore <ignoreItems>
30 A comma-delimited list of folders to ignore for changes.
31 No default
32
33 --ignore-symlinks
34 Ignore symlinks :)
35
36 -s|--timestamp
37 Log timestamp after each run.
38 Make it easy to tell when the task last ran.
39
40 -p|--poll-interval <milliseconds>
41 How often to poll watched files for changes.
42 Defaults to Node default.
43
44 -e|--extensions <extensions>
45 A comma-delimited list of file extensions to watch for changes.
46 Default is 'node,js' (or when CoffeeScript, 'node,js,coffee,litcoffee').
47
48 -x|--exec <executable>
49 The executable that runs the specified program.
50 Default is 'node'
51
52 -pid|--save-pid <path>
53 Save supervisor's process id to a file at the given path.
54
55 --debug[=port]
56 Start node with --debug flag.
57
58 --debug-brk[=port]
59 Start node with --debug-brk flag.
60
61 --harmony
62 Start node with --harmony flag.
63
64 --inspect
65 Start node with --inspect flag.
66
67 -n|--no-restart-on error|exit|success
68 Don't automatically restart the supervised program if it ends.
69 Supervisor will wait for a change in the source files.
70 If "error", an exit code of 0 will still restart.
71 If "exit", no restart regardless of exit code.
72 If "success", no restart only if exit code is 0.
73
74 -t|--non-interactive
75 Dissable interactive capacity
76 With this option, supervisor won't listen to stdin
77
78 --force-watch
79 Use fs.watch instead of fs.watchFile.
80 This may be useful if you see a high cpu load on a windows machine.
81
82 -k|--instant-kill
83 Instantly kills the server process, instead of gracefully shutting down the server.
84 This can be useful when the node app has events attached to SIGTERM or SIGINT so as to do a graceful shutdown before the process exits.
85
86 -RV|--restart-verbose
87 Logs the file(s) that caused supervisor to restart
88
89 -h|--help|-?
90 Display these usage instructions.
91
92 -q|--quiet
93 Suppress DEBUG messages
94
95
96 Options available after start:
97 rs - restart process. Useful when you want to restart your program even
98 if no file has changed.
99
100
101 Examples:
102 supervisor myapp.js
103 supervisor myapp.coffee
104 supervisor -w scripts -e myext -x myrunner myapp
105 supervisor -w lib,server.js,config.js server.js
106 supervisor -- server.js -h host -p port
107
108
109In order to not watch for file changes, use "-i .".
110
111## Simple Install
112
113Just run:
114
115 npm install supervisor -g
116
117## Fancy Install
118
119Get this code, and then do this:
120
121 npm link