mirror of
https://gitlab.com/pancakes1234/wdiscordbotserver.git
synced 2025-06-16 07:14:21 -06:00
Update server.js
This commit is contained in:
parent
0f2662cb5d
commit
cb1885c2d2
21
server.js
21
server.js
@ -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');
|
||||
|
Loading…
x
Reference in New Issue
Block a user