Back to Cron Helper
Recipesslsecuritycertbotmaintenance

Auto-Renew Let's Encrypt SSL

Cron job to automatically renew Let's Encrypt SSL certificates.

Let's Encrypt certificates expire every 90 days. The Electronic Frontier Foundation (EFF) recommends running the renewal command twice daily. The `--quiet` flag ensures the command only outputs text if an error occurs, keeping your cron logs clean.

Cron Schedule

Every 12 hours0 */12 * * *
Runs every 12 hour(s) at minute 0.

Command to Run

Copy and paste this command into your crontab or automation script

certbot renew --quiet
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
# Edit your crontab with: crontab -e
# Add this line to run "Every 12 hours"
0 */12 * * * /path/to/script.sh
Python (with schedule library)
# Using the 'schedule' library
import schedule
import time

def job():
    print("Running task: Every 12 hours")

# Note: Python's schedule lib uses natural language,
# but for raw cron execution use 'python-crontab':
# from crontab import CronTab
# cron = CronTab(user='root')
# job = cron.new(command='python job.py')
# job.setall('0 */12 * * *')
Node.js (with node-cron)
// Using 'node-cron'
const cron = require('node-cron');

cron.schedule('0 */12 * * *', () => {
  console.log('Running task: Every 12 hours');
});
Go (with robfig/cron)
// Using 'robfig/cron'
c := cron.New()
c.AddFunc("0 */12 * * *", func() {
    fmt.Println("Running task: Every 12 hours")
})
c.Start()
GitHub Actions Workflow
# .github/workflows/cron.yml
name: Every 12 hours
on:
  schedule:
    - cron: '0 */12 * * *'
jobs:
  cron:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Running Every 12 hours"

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