Next.js Discord

Discord Forum

Can I run cron jobs using node-cron if I host my nextjs app on a vps?

Answered
Order posted this in #help-forum
Open in Discord
Avatar
The auth library that I'm using needs scheduled db cleanup in order to delete the user sessions that have been invalidated. I know that hosting on vercel has it's own cron job panel where things can be set up etc, but if I'm hosting on a vps will something like node-cron work properly?
Answered by Order
LOL, I made a bash script and used windows task scheduler and it worked, who said Windows ain't a good development environment ( everyone and they are correct 🤣)
View full answer

5 Replies

Avatar
why not use the default cronjob?
You can google its documentation,
As far as I remember, the file for adding cronjob opens from cmd:
sudo crontab -e
Avatar
you mean the one built in linux?
rn I'm testing in a local environment on my own pc that's running windows so I wanted to find a way to implement them in development before deploying
Avatar
yes
Avatar
LOL, I made a bash script and used windows task scheduler and it worked, who said Windows ain't a good development environment ( everyone and they are correct 🤣)
Answer