-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
47 lines (39 loc) · 968 Bytes
/
index.js
File metadata and controls
47 lines (39 loc) · 968 Bytes
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
var restify = require('restify'),
ssh = require('ssh2').Client;
var PORT = 4000;
var server = restify.createServer({
name: 'prerender-monitoring'
});
server
.use(restify.fullResponse())
.use(restify.bodyParser());
server
.get('/', function translate (req, res, next) {
var conn = new ssh(),
all = [],
fin = '';
conn.on('ready', function () {
conn.exec('./bobo.sh;./bobo1.sh', function (err, stream) {
if (err) {
return res.send(500, err);
}
stream
.on('data', function (data) {
fin += data;
})
.on('close', function (code, signal) {
res.send(200, { data: fin, code: code, signal: signal });
conn.end();
});
});
});
conn.connect({
host: '10.0.0.76',
port: 22,
username: 'ec2-user',
privateKey: require('fs').readFileSync('/home/ubuntu/prerender.pem'),
});
});
server.listen(PORT, function () {
console.log('sourcemaps-stacktrace-started on port %s', PORT);
});