Files

19 lines
766 B
JavaScript

const { RemoteTerminal } = require('./remote_exec');
async function main() {
const term = new RemoteTerminal('wss://soc-tester-9b6540e2d4ed.hosted.ghaymah.systems/ws');
await term.connect();
console.log('Writing /tmp/persist_test_file in soc-tester...');
await term.exec('echo TEST_PERSIST > /tmp/persist_test_file');
try { await term.exec('kill -9 7'); } catch (e) {}
console.log('Waiting 8s for restart...');
await new Promise(r => setTimeout(r, 8000));
const term2 = new RemoteTerminal('wss://soc-tester-9b6540e2d4ed.hosted.ghaymah.systems/ws');
await term2.connect();
const res = await term2.exec('cat /tmp/persist_test_file || echo NOT_PERSISTED');
console.log('Result:\n', res.output);
process.exit(0);
}
main().catch(console.error);