Back to Cron Helper
Recipejavascriptnextjsreactjamstack

Trigger Next.js ISR Revalidation

Cron job to trigger Incremental Static Regeneration in Next.js.

If you use On-Demand ISR in Next.js, you can use cron to hit your API endpoint periodically. This allows you to update static content on a set schedule (e.g., hourly) rather than relying on user traffic to trigger the rebuild.

Cron Schedule

Every Hour0 * * * *
Runs at minute 0 of every hour (e.g., 1:00, 2:00, 3:00...).

Command to Run

Copy and paste this command into your crontab or automation script

curl "https://yoursite.com/api/revalidate?secret=YOUR_TOKEN"
This command will run according to the cron schedule above.

Implementation Examples

Here are code examples for implementing this cron job in different programming languages:
Unix/Linux Crontab
0 * * * * /path/to/script.sh
Python (with schedule library)
schedule.every().hour.do(job)
Node.js (with node-cron)
cron.schedule('0 * * * *', () => {
  console.log('Running every hour');
});
Go (with robfig/cron)
c.AddFunc("0 * * * *", func() { fmt.Println("Run every hour") })
GitHub Actions Workflow
- cron: "0 * * * *"

Related Cron Recipes

Automate PostgreSQL Backups Daily

How to schedule a daily PostgreSQL database backup using cron.
databasepostgresbackup

Automate MySQL Backups Daily

Schedule a daily MySQL database dump using cron.
databasemysqlbackup

Automate MongoDB Backups Daily

How to schedule a daily MongoDB backup using cron.
databasemongodbbackup

Automate Redis RDB Snapshots

Schedule a Redis background save (snapshot) via cron.
databaserediscache

PostgreSQL Vacuum Analyze

Automate PostgreSQL database maintenance with VACUUM ANALYZE.
databasepostgresmaintenance

Sync Folder to AWS S3

Cron job to sync local files to an AWS S3 bucket.
awscloudbackup