35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
const { Client } = require('ssh2');
|
|
|
|
const conn = new Client();
|
|
|
|
conn.on('ready', () => {
|
|
console.log('=== 检查Nginx配置 ===');
|
|
|
|
conn.exec('cat /etc/nginx/conf.d/default.conf', (err, stream) => {
|
|
if (err) { console.log('ERR:', err); conn.end(); return; }
|
|
let data = '';
|
|
stream.on('data', (d) => data += d.toString());
|
|
stream.on('close', () => {
|
|
console.log(data);
|
|
|
|
console.log('\n=== 检查网站首页内容 ===');
|
|
conn.exec('curl -sL https://hs.yifenbao.cn/', (err2, stream2) => {
|
|
if (err2) { console.log('ERR2:', err2); conn.end(); return; }
|
|
let html = '';
|
|
stream2.on('data', (d) => html += d.toString());
|
|
stream2.on('close', () => {
|
|
console.log(html.substring(0, 500));
|
|
|
|
console.log('\n=== 检查前端文件 ===');
|
|
conn.exec('ls -la /www/huishou/dist/build/h5/', (err3, stream3) => {
|
|
if (err3) { console.log('ERR3:', err3); conn.end(); return; }
|
|
stream3.on('data', (d) => console.log(d.toString()));
|
|
stream3.on('close', () => conn.end());
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
conn.connect({ host: 'hs.yifenbao.cn', port: 22, username: 'root', password: 'Torch1112' }); |