26 lines
545 B
JavaScript
26 lines
545 B
JavaScript
import { Client } from 'ssh2';
|
|
|
|
const conn = new Client();
|
|
|
|
conn.on('ready', () => {
|
|
console.log('=== 修复数据文件 ===\n');
|
|
|
|
conn.exec('docker start huishou-backend', (err, stream) => {
|
|
if (err) { console.log('ERR:', err); conn.end(); return; }
|
|
stream.on('close', () => {
|
|
console.log('容器已启动');
|
|
conn.end();
|
|
});
|
|
});
|
|
});
|
|
|
|
conn.on('error', (err) => {
|
|
console.log('连接错误:', err.message);
|
|
});
|
|
|
|
conn.connect({
|
|
host: 'hs.yifenbao.cn',
|
|
port: 22,
|
|
username: 'root',
|
|
password: 'Torch1112'
|
|
}); |