Skip to content
← Back to Community
I would like to run the code in a repl once an hour. What's the easiest way to get this done?
Profile icon
h
has Hacker Plan
JohannesSeiko

Locally this would just be a Cronjob, but I'm not sure what the best/easiest way is to do it on repl.it. Thanks!

Voters
Profile icon
Kalarma
Profile icon
JohannesSeiko
Comments
hotnewtop
Profile icon
Bookie0

not sure, but i googled it and found something similar:

https://repl.it/talk/ask/schedule-run-of-repl/9091

Profile icon
Coder100

Is a cronjob not working?

Here's what I did:

# .replit run="sh main.sh"
# main.sh while [ true ]; do node . done
// magic setTimeout(() => {process.exit()}, 60 * 1000)

So basically it just exits, but the bash script will run it again due to the loop.

Also, why doesn't your good old setInterval not a solution?

Profile icon
gibbsfreenergy

Unfortunately is seems you will have to manually run the code by yourself. Sorry, Hope this helps and have a great day !