39 lines
1004 B
JavaScript
39 lines
1004 B
JavaScript
import { Client } from 'ssh2';
|
|
|
|
const conn = new Client();
|
|
|
|
conn.on('ready', () => {
|
|
console.log('=== 检查dist目录 ===\n');
|
|
|
|
conn.exec('ls -la /www/huishou/dist/', (err, stream) => {
|
|
if (err) { console.log('ERR:', err); conn.end(); return; }
|
|
let output = '';
|
|
stream.on('data', (d) => output += d.toString());
|
|
stream.on('close', () => {
|
|
console.log('dist目录:');
|
|
console.log(output);
|
|
|
|
conn.exec('ls -la /www/huishou/dist/build/', (err, stream2) => {
|
|
if (err) { console.log('ERR:', err); conn.end(); return; }
|
|
let output2 = '';
|
|
stream2.on('data', (d) => output2 += d.toString());
|
|
stream2.on('close', () => {
|
|
console.log('\nbuild目录:');
|
|
console.log(output2);
|
|
conn.end();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
conn.on('error', (err) => {
|
|
console.log('连接错误:', err.message);
|
|
});
|
|
|
|
conn.connect({
|
|
host: 'hs.yifenbao.cn',
|
|
port: 22,
|
|
username: 'root',
|
|
password: 'Torch1112'
|
|
}); |