Update server.js

This commit is contained in:
pancakes-proxy 2025-03-11 07:21:56 -04:00 committed by GitHub
parent 0f2662cb5d
commit cb1885c2d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,6 +38,27 @@ io.on('connection', (socket) => {
});
});
const { exec } = require('child_process');
// Function to run idle.sh
function runIdleScript() {
exec('bash idle.sh', (error, stdout, stderr) => {
if (error) {
console.error(`Error executing idle.sh: ${error.message}`);
return;
}
if (stderr) {
console.error(`Script error: ${stderr}`);
return;
}
console.log(`Idle script output: ${stdout}`);
});
}
// Schedule idle.sh to run every 5 minutes (300,000 ms)
setInterval(runIdleScript, 300000); // Adjust the interval as needed
// Start the server
server.listen(3000, () => {
console.log('Server is running on http://localhost:3000');