26 lines
610 B
JavaScript
26 lines
610 B
JavaScript
const { Client } = require('ssh2');
|
|
|
|
const config = {
|
|
host: '103.185.47.52',
|
|
port: 2222,
|
|
username: 'adminbackend',
|
|
password: 'htEo7x6LsBQiEHHH',
|
|
readyTimeout: 60000
|
|
};
|
|
|
|
const conn = new Client();
|
|
conn.on('ready', () => {
|
|
const cmd = `
|
|
echo "=== PM2 STATUS ==="
|
|
~/.npm-global/bin/pm2 list || pm2 list || npx pm2 list
|
|
`;
|
|
conn.exec(cmd, (err, stream) => {
|
|
if (err) throw err;
|
|
stream.on('close', () => conn.end());
|
|
stream.on('data', (d) => process.stdout.write(d.toString()));
|
|
stream.stderr.on('data', (d) => process.stderr.write(d.toString()));
|
|
});
|
|
}).connect(config);
|
|
|
|
|