Cron Job Submit Sitemap Google Search Console Daily
Ping Google Search Console with your sitemap every night at midnight so new pages get crawled and indexed faster.
What this schedule does
The expression 0 0 * * * fires at exactly midnight (00:00) every day. The five fields mean: minute=0, hour=0, any day of month, any month, any day of week. It runs 365 times a year — once per calendar day.
A daily sitemap ping tells Google (and other search engines) that your sitemap has potentially changed. Google may have already crawled it, but a fresh ping signals that new URLs are waiting. For sites that publish content daily — blogs, e-commerce catalogs, news sites — this keeps the index lag as short as possible.
How to ping Google with your sitemap
Google's legacy ping endpoint accepts a simple GET request with your sitemap URL as a query parameter. No authentication is required:
curl -s "https://www.google.com/ping?sitemap=https://example.com/sitemap.xml"
This returns a 200 with a short HTML confirmation. You can also ping Bing at the same time:
curl -s "https://www.bing.com/ping?sitemap=https://example.com/sitemap.xml"
IndexNow (modern alternative): Microsoft, Yandex, and other engines support IndexNow — a push protocol where you submit individual URLs the moment they change, rather than pinging a full sitemap. If your CMS supports IndexNow, that is more precise than a daily batch ping. For sites without IndexNow support, the daily cron approach remains solid.
# IndexNow — submit a specific URL immediately after publishing
curl -X POST "https://api.indexnow.org/indexnow" \
-H "Content-Type: application/json" \
-d '{
"host": "example.com",
"key": "YOUR_INDEXNOW_KEY",
"urlList": ["https://example.com/new-page"]
}'
Generate your IndexNow key at bing.com/indexnow and place the key file at the root of your site.
Platform snippets
# crontab -e
# Ping Google and Bing with your sitemap every night at midnight
0 0 * * * curl -s "https://www.google.com/ping?sitemap=https://example.com/sitemap.xml" && \
curl -s "https://www.bing.com/ping?sitemap=https://example.com/sitemap.xml"
on:
schedule:
- cron: '0 0 * * *' # UTC midnight — runs every day
jobs:
ping-sitemap:
runs-on: ubuntu-latest
steps:
- name: Ping Google Search Console
run: |
curl -s "https://www.google.com/ping?sitemap=${{ vars.SITE_URL }}/sitemap.xml"
- name: Ping Bing
run: |
curl -s "https://www.bing.com/ping?sitemap=${{ vars.SITE_URL }}/sitemap.xml"
# EventBridge cron (6 fields — adds year, UTC)
# Trigger a Lambda or Step Function that calls the ping endpoints
cron(0 0 * * ? *)
# Example Lambda handler (Python)
import urllib.request
def handler(event, context):
sitemap = "https://example.com/sitemap.xml"
for engine in [
f"https://www.google.com/ping?sitemap={sitemap}",
f"https://www.bing.com/ping?sitemap={sitemap}",
]:
urllib.request.urlopen(engine)
return {"status": "pinged"}
apiVersion: batch/v1
kind: CronJob
metadata:
name: sitemap-ping
spec:
schedule: "0 0 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: ping
image: curlimages/curl:latest
command:
- sh
- -c
- |
curl -s "https://www.google.com/ping?sitemap=https://example.com/sitemap.xml"
curl -s "https://www.bing.com/ping?sitemap=https://example.com/sitemap.xml"
restartPolicy: OnFailure
Timezone note
Standard crontab uses the system timezone. GitHub Actions and AWS EventBridge run in UTC — midnight UTC may be afternoon or evening in your local timezone, which is usually fine for an indexing ping. If you want the ping to go out at local midnight, adjust the hour accordingly: for US Eastern (UTC-5), use 0 5 * * * to hit midnight ET. Kubernetes 1.27+ supports spec.timeZone: "America/New_York".