33 lines
1.3 KiB
JavaScript
33 lines
1.3 KiB
JavaScript
const { Client } = require('ssh2');
|
|
|
|
const conn = new Client();
|
|
|
|
conn.on('ready', () => {
|
|
console.log('=== 检查服务器目录结构 ===\n');
|
|
|
|
conn.exec('ls -la /www/', (err, stream) => {
|
|
if (err) { console.log('ERR:', err); }
|
|
else { stream.on('data', (d) => console.log('/www/ 目录:\n', d.toString())); }
|
|
stream.on('close', () => {
|
|
conn.exec('ls -la /www/huishou/', (err2, stream2) => {
|
|
if (err2) { console.log('ERR2:', err2); }
|
|
else { stream2.on('data', (d2) => console.log('/www/huishou/ 目录:\n', d2.toString())); }
|
|
stream2.on('close', () => {
|
|
conn.exec('ls -la /www/huishou/dist/build/h5/', (err3, stream3) => {
|
|
if (err3) { console.log('ERR3:', err3); }
|
|
else { stream3.on('data', (d3) => console.log('/www/huishou/dist/build/h5/ 目录:\n', d3.toString())); }
|
|
stream3.on('close', () => {
|
|
conn.exec('ls -la /www/huishou/admin/', (err4, stream4) => {
|
|
if (err4) { console.log('ERR4:', err4); }
|
|
else { stream4.on('data', (d4) => console.log('/www/huishou/admin/ 目录:\n', d4.toString())); }
|
|
stream4.on('close', () => conn.end());
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
conn.connect({ host: 'hs.yifenbao.cn', port: 22, username: 'root', password: 'Torch1112' }); |