artdaq_node_server
v1_00_11
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Variables
src
modules
iostat
server
iostat_module.js
1
// iostat.js : Run IOStat command
2
// Author: Eric Flumerfelt, FNAL RSI
3
// Last Modified: December 23, 2014
4
// Compatibility updates to work with serverbase.js v0.4
5
//
6
7
// Node.js framework "includes"
8
var spawn = require(
'child_process'
).spawn;
9
var emitter = require(
'events'
).EventEmitter;
10
var iostatem =
new
emitter();
11
12
iostatem.MasterInitFunction =
function
() {
return
null; };
13
14
// The function which runs "iostat"
15
iostatem.GET_ =
function
() {
16
var iostat = spawn(
'iostat'
);
17
18
// Emit data events whenever stdout or stderr are written
19
iostat.stdout.on(
'data'
,
function
(data) {
20
iostatem.emit(
'data'
,data.toString() +
"\n"
);
21
});
22
23
// Emit data events whenever stdout or stderr are written
24
iostat.stderr.on(
'data'
,
function
(data) {
25
iostatem.emit(
'data'
,data.toString() +
"\n"
);
26
});
27
28
// When the program is done, return the status code
29
iostat.on(
'close'
,
function
(code) {
30
iostatem.emit(
'end'
, code);
31
});
32
}
33
34
module.exports =
function
(module_holder) {
35
module_holder[
"iostat"
] = iostatem;
36
};
Generated on Fri Oct 6 2017 18:53:58 for artdaq_node_server by
1.8.5