const { Client } = require('ssh2'); const conn = new Client(); conn.on('ready', () => { console.log('=== 验证服务器文件 ==='); // 检查weigh页面文件 conn.exec('grep -l "累加" /www/huishou/dist/build/h5/assets/pages-weigh-weigh*.js', (err, stream) => { if (err) { console.log('ERR:', err); } else { stream.on('data', (d) => console.log('包含累加的weigh文件:', d.toString().trim())); } stream.on('close', () => { // 检查index.html conn.exec('cat /www/huishou/dist/build/h5/index.html', (err2, stream2) => { if (err2) { console.log('ERR2:', err2); } else { stream2.on('data', (d2) => console.log('index.html:', d2.toString())); } stream2.on('close', () => { // 测试网站 conn.exec('curl -s -I https://hs.yifenbao.cn/ | head -5', (err3, stream3) => { if (err3) { console.log('ERR3:', err3); } else { stream3.on('data', (d3) => console.log('网站状态:', d3.toString())); } stream3.on('close', () => conn.end()); }); }); }); }); }); }); conn.connect({ host: '101.200.232.171', port: 22, username: 'root', password: 'Torch1112' });