-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathforever.node_cli.txt
54 lines (46 loc) · 3.19 KB
/
forever.node_cli.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
┏━━━━━━━━━━━━━┓
┃ FOREVER ┃
┗━━━━━━━━━━━━━┛
ALTERNATIVES ==> #See pm2
forever ACTION #Command line Node module (0.11.1)
#OPTIONS are after the ACTION word. NODESCRIPT_OPTS after NODESCRIPT
#Can be:
# - start NODESCRIPT:
# - run NODESCRIPT as daemon, non-attached to current browser
# - maintained by forever, which is also started as non-attached daemon
# - redirect stdout|err to /dev/null (unless -o|e PATH)
# - redirect forever output to ~/.forever/NODESCRIPT_NAME.log (unless -l FILENAME)
# (referred as LOGS here)
# - every NODESCRIPT gets a NODESCRIPT_INDEX
# - restart it automatically every time it stopped
# - stop NODESCRIPT[_INDEX|NAME]:
# - if matches several possible, stop several
# - restart NODESCRIPT[_INDEX|NAME]
# - stop|restartall
# - list: show all current NODESCRIPT: path, pid, logfile, uptime, NODESCRIPT_INDEX
# - logs: same as list but only with columns path and logfile
# - logs NODESCRIPT[_INDEX|NAME]: prints concatenated LOGS
# - cleanlogs: deletes all LOGS (except running NODESCRIPT)
# - set KEY VAL, clear KEY, config (show all):
# - manipulates forever config file at ~/.forever/config.json (none interesting)
--uid NODESCRIPT_NAME #Def: random
-m NUM #Max. time to restart automatically
--minUptime NUMms #Don't restart NODESCRIPT if it was run for less (def: 100ms)
--spinSleepTime NUMms #Delay in restarting (def: 0ms)
-a #Appends LOGS (overwise will not start NODESCRIPT if LOGS exists)
-f #Log redirection duplex it to console output
--watch #Restart when files on --watchDirectory DIR, except --watchIgnore FILE are changed.
#Prefer using Nodemon
FOREVER-MONITOR #Same but as Node module (1.2.3)
FOREVER-MONITOR.start #Returns FOREVER
(NODESCRIPT, OBJ) #OBJ are options: uid, max, minUptime, spinSleepTime, command, options (passed to NODESCRIPT_STR)
#watch*, env, log|out|errFile
FOREVER.on("start",
FUNC(OBJ2, OBJ3)) #OBJ2 and OBJ3 contain info about NODESCRIPT and OBJ (see online doc)
FOREVER.on("restart",
FUNC(OBJ2, OBJ3)) #
FOREVER.on("stop", FUNC()) #Stopped by FOREVER
FOREVER.on("exit",FUNC(OBJ2)) #Finished and not restarted
FOREVER.on("error", FUNC())
FOREVER.on("stdout|err",
FUNC(BUFFER)) #