1
1
# dcrspy
2
2
3
+ [ ![ Build Status] ( http://img.shields.io/travis/chappjc/dcrspy.svg )] ( https://travis-ci.org/chappjc/dcrspy )
4
+ [ ![ ISC License] ( http://img.shields.io/badge/license-ISC-blue.svg )] ( http://copyfree.org )
3
5
[ ![ Gitter] ( https://badges.gitter.im/chappjc/dcrspy.svg )] ( https://gitter.im/chappjc/dcrspy?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge )
4
6
5
7
dcrspy is a program to continuously monitor and log changes in various data
@@ -19,6 +21,63 @@ wallet connection is available.
19
21
20
22
See [ Data Details] ( #data-details ) below for more information.
21
23
24
+ ## Arbitrary Command Execution
25
+
26
+ When dcrspy receives a new block notification from dcrd, data collection and
27
+ recording is triggered. In addition, any system command may be executed in
28
+ response to the new block. The flags to specify the command and the arguments
29
+ to be used are:
30
+
31
+ -c, --cmdname= Command name to run. Must be on %PATH%.
32
+ -a, --cmdargs= Comma-separated list of arguments for command to run.
33
+
34
+ The command name must be an executable (binary or script) on your PATH, which
35
+ is $PATH in * NIX, and %PATH% in Windows.
36
+
37
+ ### Command Arguments
38
+
39
+ Any arguments must be specified with
40
+ cmdargs as a comma-separated list of strings. For example:
41
+
42
+ -c ping -a "127.0.0.1,-n,8"
43
+
44
+ will execute the following on Linux:
45
+
46
+ /usr/bin/ping 127.0.0.1 -n 8
47
+
48
+ Specifying multiple arguments without commas, using spaces directly, is
49
+ incorrect. For example, ` -a "127.0.0.1 -n 8" ` will not work.
50
+
51
+ Note that if your command line arguments need to start with a dash (` - ` ) it is
52
+ necessary to use the config file. For example,
53
+
54
+ cmdname=ls
55
+ cmdargs="-al"
56
+
57
+ ### Block Hash and Height Substitution
58
+
59
+ The new block hash and height at the time of command execution may be included
60
+ on the command line using %h and %n, which are substituted for block hash and
61
+ number. For example,
62
+
63
+ cmdname=echo
64
+ cmdargs="New best block hash: %h; height: %n"
65
+
66
+ results in the following log entries (date removed for brevity):
67
+
68
+ [INF] DCRD: Block height 36435 connected
69
+ [INF] EXEC: New best block hash: 000000000000070f7a0593aee0728d6b3334c1e454da06efc0138008dc1b1cbd; height: 36435
70
+ [INF] EXEC: Command execution complete (success).
71
+
72
+ Note that the above command used a semicolon since a comma would have indicated
73
+ a second argument and been replaced with a space by echo.
74
+
75
+ ### Command Logging
76
+
77
+ User-specified system command execution uses the logging subsystem tagged with
78
+ EXEC in the logs. Both stdout and stderr for the executed command are sent to
79
+ the dcrspy log. The end of command execution is also logged, as shown in the
80
+ example above.
22
81
23
82
## Output
24
83
@@ -114,53 +173,46 @@ Quick tips:
114
173
* JSON to file system, with ` -j, --save-jsonfile ` .
115
174
* To monitor only block data (no wallet connection), use ` --nostakeinfo ` .
116
175
117
- The full list of command line switches is below.
176
+ The full list of command line switches is below, with current directory
177
+ replaced by ` ... ` :
118
178
119
179
~~~ none
180
+ $ ./dcrspy -h
120
181
Usage:
121
- dcrspy.exe [OPTIONS]
182
+ dcrspy [OPTIONS]
122
183
123
184
Application Options:
124
- /C, /configfile: Path to configuration file
125
- (...\dcrspy.conf)
126
- /V, /version Display version information and exit
127
- /testnet Use the test network (default mainnet)
128
- /simnet Use the simulation test network (default mainnet)
129
- /d, /debuglevel: Logging level {trace, debug, info, warn, error,
130
- critical} (info)
131
- /q, /quiet Easy way to set debuglevel to error
132
- /logdir: Directory to log output (...\logs)
133
- /e, /nomonitor Do not launch monitors. Display current data and
134
- (e)xit.
135
- /noblockdata Do not collect block data (default false)
136
- /nostakeinfo Do not collect stake info data (default false)
137
- /f, /outfolder: Folder for file outputs (...\spydata)
138
- /s, /summary Write plain text summary of key data to stdout
139
- /o, /save-jsonstdout Save JSON-formatted data to stdout
140
- /j, /save-jsonfile Save JSON-formatted data to file
141
- /dcrduser: Daemon RPC user name
142
- /dcrdpass: Daemon RPC password
143
- /dcrdserv: Hostname/IP and port of dcrd RPC server to connect to
144
- (default localhost:9109, testnet: localhost:19109,
145
- simnet: localhost:19556)
146
- /dcrdcert: File containing the dcrd certificate file
147
- (%localappdata%\Dcrd\rpc.cert)
148
- /dcrwuser: Wallet RPC user name
149
- /dcrwpass: Wallet RPC password
150
- /dcrwserv: Hostname/IP and port of dcrwallet RPC server to
151
- connect to (default localhost:9110, testnet:
152
- localhost:19110, simnet: localhost:19557)
153
- /dcrwcert: File containing the dcrwallet certificate file
154
- (%localappdata%\Dcrwallet\rpc.cert)
155
- /noclienttls Disable TLS for the RPC client -- NOTE: This is only
156
- allowed if the RPC client is connecting to localhost
157
- /accountname: Name of the account from (default: default) (default)
158
- /ticketaddress: Address to which you have given voting rights
159
- /pooladdress: Address to which you have given rights to pool fees
185
+ -C, --configfile= Path to configuration file (.../dcrspy.conf)
186
+ -V, --version Display version information and exit
187
+ --testnet Use the test network (default mainnet)
188
+ --simnet Use the simulation test network (default mainnet)
189
+ -d, --debuglevel= Logging level {trace, debug, info, warn, error, critical} (info)
190
+ -q, --quiet Easy way to set debuglevel to error
191
+ --logdir= Directory to log output (.../logs)
192
+ -c, --cmdname= Command name to run. Must be on %PATH%.
193
+ -a, --cmdargs= Comma-separated list of aruguments for command to run.
194
+ -e, --nomonitor Do not launch monitors. Display current data and (e)xit.
195
+ --noblockdata Do not collect block data (default false)
196
+ --nostakeinfo Do not collect stake info data (default false)
197
+ -f, --outfolder= Folder for file outputs (.../spydata)
198
+ -s, --summary Write plain text summary of key data to stdout
199
+ -o, --save-jsonstdout Save JSON-formatted data to stdout
200
+ -j, --save-jsonfile Save JSON-formatted data to file
201
+ --dcrduser= Daemon RPC user name
202
+ --dcrdpass= Daemon RPC password
203
+ --dcrdserv= Hostname/IP and port of dcrd RPC server to connect to (default localhost:9109, testnet: localhost:19109, simnet: localhost:19556)
204
+ --dcrdcert= File containing the dcrd certificate file (~/.dcrd/rpc.cert)
205
+ --dcrwuser= Wallet RPC user name
206
+ --dcrwpass= Wallet RPC password
207
+ --dcrwserv= Hostname/IP and port of dcrwallet RPC server to connect to (default localhost:9110, testnet: localhost:19110, simnet: localhost:19557)
208
+ --dcrwcert= File containing the dcrwallet certificate file (~/.dcrwallet/rpc.cert)
209
+ --noclienttls Disable TLS for the RPC client -- NOTE: This is only allowed if the RPC client is connecting to localhost
210
+ --accountname= Name of the account from (default: default) (default)
211
+ --ticketaddress= Address to which you have given voting rights
212
+ --pooladdress= Address to which you have given rights to pool fees
160
213
161
214
Help Options:
162
- /? Show this help message
163
- /h, /help Show this help message
215
+ -h, --help Show this help message
164
216
~~~
165
217
166
218
### Config file
@@ -176,12 +228,13 @@ debuglevel=debug
176
228
; Default outfolder is a folder called "dcrspy" in the working directory.
177
229
; Change this with the outfolder option:
178
230
; Windows
179
- outfolder =%appdata%/dcrspy/spydata
231
+ ; outfolder=%appdata%/dcrspy/spydata
180
232
; Linux
181
233
; outfolder=$HOME/dcrspy/spydata
182
234
183
235
; Uncomment for testnet
184
236
; testnet=1
237
+ ; But also remember ports below, or do not specify for network defaults.
185
238
186
239
dcrduser =duser
187
240
dcrdpass =asdfExample
0 commit comments