How to do something every hour/day?

Hi,
I want to do something every day, and I don’t want to overload the servers with tricks to get it permanently running. Is there any way?

You can use a web cron service like cron-job.org to make a http request to a route you create in your app that triggers whatever it is you want to do each day.

1 Like

Thanks for the tip, cron-job.org works great for this! Just one heads up for anyone planning to use it – if a request fails, cron-job.org will pause your recurring task and you’ll need to manually go on and start it up again.

Would love if there were a way to trigger something like this from within an app!

Hey @bcjordan welcome!

If you are using an express server you could add a http trigger like this

app.get('/cronjob', (req, res) => {
	/* Your code here */
	res.status(200).send('Job done!');
});

Then use UptimeRobot to trigger that http request with http://your-project-name.glitch.me/cronjob and you can setup the time interval there.

Should be other solutions and clever ones. But this one works fine for me :slight_smile:

1 Like

just use this

app@ilaaj:~ 17:31
$ crontab -u app -e
no crontab for app - using an empty one

Select an editor. To change later, run ‘select-editor’.

  1. /bin/nano <---- easiest
  2. /usr/bin/emacs24
  3. /usr/bin/vim.basic

Choose 1-3 [1]: 1
crontab: installing new crontab

use crontab -u app -l to check.