44 lines
1.0 KiB
JavaScript
44 lines
1.0 KiB
JavaScript
import { Client } from 'ssh2';
|
|
|
|
const conn = new Client();
|
|
|
|
conn.on('ready', () => {
|
|
console.log('=== 检查index.html ===\n');
|
|
|
|
conn.exec('cat /www/huishou/dist/build/h5/index.html', (err, stream) => {
|
|
if (err) {
|
|
console.log('读取失败:', err.message);
|
|
} else {
|
|
stream.on('data', (data) => {
|
|
console.log('index.html:', data.toString());
|
|
});
|
|
}
|
|
|
|
stream.on('close', () => {
|
|
conn.exec('ls -la /www/huishou/dist/build/h5/assets/index*.js 2>/dev/null || echo "No index*.js found"', (err, stream2) => {
|
|
if (err) {
|
|
console.log('检查JS失败:', err.message);
|
|
} else {
|
|
stream2.on('data', (data2) => {
|
|
console.log('\nJS文件:', data2.toString());
|
|
});
|
|
}
|
|
|
|
stream2.on('close', () => {
|
|
conn.end();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
conn.on('error', (err) => {
|
|
console.log('连接错误:', err.message);
|
|
});
|
|
|
|
conn.connect({
|
|
host: 'hs.yifenbao.cn',
|
|
port: 22,
|
|
username: 'root',
|
|
password: 'Torch1112'
|
|
}); |