Run console commands after x minutes


Is it possible that I could get a scheduled command (refresh) to run every x seconds for my npm project?


Cron is a tool that allows you to execute something on a schedule. There are many cron-related npm packages available, which you’d have to use alongside a method to keep your project alive. Or you could use a third-party cron service like or UptimeRobot to trigger a command via a HTTP request and run the command using child_process.exec.


I use UptimeRobot to keep it running but not refreshing (at least i think). I’m not entirely sure about what you said on how to set it up. Is there a tutorial or a more in depth way you could show me how to run the refresh command every X minutes?


thismay be a shitty solution, but this js actually forces the glitch’s main script to restart by throwing an error:

const resetter = setTimeout(function() {
console.log(Restarting Glitch project...);
throw void 0;
}, 5 * (60000));


Add at the top of your JS file:

var child_process = require('child_process');

Then within the route you have defined that UptimeRobot pings add:

child_process.exec('refresh', function(error, stdout, stderr){


It works! Thank you very much!