On my desktop I use them for taking snapshots of my file system every 15 minutes, hour, and day.
For the product I work on for pay, we use them to every minute scan for new data + perform actions based on it. We had it as a daemon before but it would occasionally get into bad states due to unforeseen input so we turned in into a cronjob. If it gets into a bad state, it just dies, and gets rerun a minute later. Generally this is good enough as bad states are transient and minute latency is fine for us.
I use a corn job to fire a off a function within a wordpress plugin that needs to happen every Tuesday at 2PM. Wordpress has a "cron job" which is more like a timer that will fire every hour or once every 24 hours.
The reason why I don't use this is because once I have a client's site live I want to be able to activate the plugin at any time and just let the cron job know when it is Tuesday at 2 to fire the function.
Hey @goenning yes it is similar, but a serverless function unlike a cron is not tightly coupled to a single vm and that’s why it makes more sense in a complex architecture IMHO - I agree with you extensive use of cron jobs is an “ops smell” unless all your cron jobs are under version control and managed through your CI/CD pipeline
Mostly using Kubernetes cronJobs:
Well I'm using self-hosted email software and they use cron jobs that run each minute to send scheduled emails / autoresponder emails.
On my desktop I use them for taking snapshots of my file system every 15 minutes, hour, and day.
For the product I work on for pay, we use them to every minute scan for new data + perform actions based on it. We had it as a daemon before but it would occasionally get into bad states due to unforeseen input so we turned in into a cronjob. If it gets into a bad state, it just dies, and gets rerun a minute later. Generally this is good enough as bad states are transient and minute latency is fine for us.
The whole system every 15min? How long does it take?
I use ZFS so it is instant.
I have a texting service that sends people that opt in daily (very silly) facts
Haha good use case😀. Do you have a seperate computer/vps for this task? Or do you leverage some server you already use?
I use cron jobs on different devices, for different purposes:
I use a corn job to fire a off a function within a wordpress plugin that needs to happen every Tuesday at 2PM. Wordpress has a "cron job" which is more like a timer that will fire every hour or once every 24 hours.
The reason why I don't use this is because once I have a client's site live I want to be able to activate the plugin at any time and just let the cron job know when it is Tuesday at 2 to fire the function.
cron jobs are like a Swiss knife, very versatile but not particularly good at solving any specific problem.
I use them exclusively in small projects that don't need to scale up and are not going to be updated often (if ever).
In any other case I will use more scalable solutions like job queues, scheduled serverless functions etc.
But since we are on Indie Hackers, probably many of us are working on smaller projects with simple architecture so I can see why they would be useful.
It’s a scheduled serverless function just another Cron?
I suppose crons are now another bad smell in most architectures
Hey @goenning yes it is similar, but a serverless function unlike a cron is not tightly coupled to a single vm and that’s why it makes more sense in a complex architecture IMHO - I agree with you extensive use of cron jobs is an “ops smell” unless all your cron jobs are under version control and managed through your CI/CD pipeline