- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2023 12:38 AM
Hi @pcbzmani
A cron expression doesn't inherently support the concept of running a job for a specific number of days and then stopping. Cron is designed to schedule recurring tasks at regular intervals.
If you want to run a job every day for up to 30 days, you could use the cron expression "0 0 * * *" to run the job every day at midnight. However, you would need to implement additional logic outside of the cron schedule to stop the job after 30 days.
This could be done, for example, by storing the start date of the job in a database or file, and then checking this date each time the job runs. If the current date is 30 days or more after the start date, the job could then stop itself.
Again, the exact implementation of this would depend on the system you're using to schedule and run your jobs.