28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
|
|
const { Client } = require('ssh2');
|
||
|
|
const conn = new Client();
|
||
|
|
const config = {
|
||
|
|
host: '119.45.10.34',
|
||
|
|
port: 22,
|
||
|
|
username: 'root',
|
||
|
|
password: '#xyzh%CS#2512@28',
|
||
|
|
readyTimeout: 10000,
|
||
|
|
};
|
||
|
|
|
||
|
|
conn.on('ready', () => {
|
||
|
|
// 1. 查看 .env 中的 AppId 配置
|
||
|
|
// 2. 查看最新 StartVoiceChat 和 UpdateVoiceChat 的 AppId/TaskId/RoomId
|
||
|
|
const cmd = `echo "=== ENV AppId ===" && grep 'VOLC_RTC_APP_ID' /www/wwwroot/demo.tensorgrove.com.cn/server/.env && echo "=== Latest StartVoiceChat Body (AppId+TaskId) ===" && grep -A 30 'Full request body' /var/log/bigwo/server-out.log | tail -35 && echo "=== Latest UpdateVoiceChat params ===" && grep -A 10 'UpdateVoiceChat params' /var/log/bigwo/server-out.log | tail -25`;
|
||
|
|
conn.exec(cmd, (err, stream) => {
|
||
|
|
if (err) { console.error('exec error:', err); conn.end(); return; }
|
||
|
|
let out = '';
|
||
|
|
stream.on('data', d => out += d.toString());
|
||
|
|
stream.stderr.on('data', d => process.stderr.write(d));
|
||
|
|
stream.on('close', () => {
|
||
|
|
console.log(out || '(no output)');
|
||
|
|
conn.end();
|
||
|
|
});
|
||
|
|
});
|
||
|
|
}).on('error', err => {
|
||
|
|
console.error('SSH error:', err.message);
|
||
|
|
}).connect(config);
|