39 lines
1013 B
JavaScript
39 lines
1013 B
JavaScript
const { Client } = require('ssh2');
|
|
|
|
const conn = new Client();
|
|
|
|
conn.on('ready', () => {
|
|
console.log('=== 验证上传 ===\n');
|
|
|
|
conn.exec('ls -la /www/huishou/dist/build/h5/assets/index*.js', (err, stream) => {
|
|
if (err) {
|
|
console.log('JS文件不存在:', err.message);
|
|
} else {
|
|
stream.on('data', (data) => {
|
|
console.log('JS文件:', data.toString());
|
|
});
|
|
}
|
|
|
|
stream.on('close', () => {
|
|
conn.exec('cat /www/huishou/dist/build/h5/index.html', (err, stream2) => {
|
|
if (err) {
|
|
console.log('HTML不存在:', err.message);
|
|
} else {
|
|
stream2.on('data', (data2) => {
|
|
console.log('\nHTML内容:', 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' }); |