Cron VS Anacron
Cron jobs and anacron jobs are both ways to tell your computer they need to run a task every X amount of time ranging from min, hour, day of month, month, and day of week. Both can be implemented directly from the command line from the crontab and anacrontab respectively. They both are incredibly similar with the main difference being if your system will be on continuously or not. A cron job expects to run over and over without interruption if there is one the cronjob will not run. An anacron job expects interruptions, like the powering down of your system, if this does occur an anacron job will run as soon as the system is back up. The biggest issue with both cron and anacron jobs are they are both designed to run by the minute and cannot be broken down sub-minute due to the job having to start and restart so close to one another. An easy way to get around this is to create duplicate cron jobs that are broken up by the interval you want them to run, so if you want them to run every 30 seconds you would need to make the original then a duplicate that sleeps for 30 seconds. The system will see these are two different cron jobs that need to run at different times, but the process will occur like the same cron job is happening every 30 seconds. I am currently looking for a finer way of tuning cron and anacron jobs and would welcome any comments if anyone has any ideas.
Sr. PHP Developer with Symfony and Api-Platform Experience.
5ySupervisord is probably more suited to what you're wanting to do.
DevOps | Site Reliability Engineer | AWS Certified | Cloud Cost Management | Kubernetes | Scalable Solutions Architect | Observability Evangelist
5yWhat problem are you trying to solve?
Fullstack Staff Software Engineer
5yIf you want these jobs to run every 30 seconds then in my opinion CRON jobs are the wrong abstraction. In general writing anything that is guaranteed to run every 30 seconds would be tricky and hard to maintain depending on the use case.