Skip to content
HomeKnowledge BaseStatisticsChangelog GitHub Discord Email
developer / Custom Cron

No results for ""

Custom Cron

Overview

You can hook into any of Demyx's cron intervals by placing a shell script in the corresponding file under /demyx/custom/cron/. Demyx executes these scripts at the end of each cron run.

Available Intervals

FileRuns
/demyx/custom/cron/minute.shEvery minute
/demyx/custom/cron/five-minute.shEvery 5 minutes
/demyx/custom/cron/hourly.shEvery hour
/demyx/custom/cron/six-hour.shEvery 6 hours
/demyx/custom/cron/daily.shDaily
/demyx/custom/cron/weekly.shWeekly

Example Scripts

All example scripts follow the same template:

bash
#!/bin/bash
# Demyx custom cron — daily
set -euo pipefail

demyx_custom_daily() {
    # Your custom logic here
    echo "Running custom daily task"
}

demyx_custom_daily "$@"

Use Cases

Off-site backup sync (daily)

bash
#!/bin/bash
set -euo pipefail

demyx_custom_daily() {
    # Sync backups to S3
    aws s3 sync /demyx/backup/ s3://your-bucket/demyx-backups/ --delete
}

demyx_custom_daily "$@"

Monitoring ping (five-minute)

bash
#!/bin/bash
set -euo pipefail

demyx_custom_five_minute() {
    # Ping a status page
    curl -fsS "https://uptime.betterstack.com/api/v1/heartbeat/YOUR_TOKEN" > /dev/null
}

demyx_custom_five_minute "$@"

Weekly cleanup (weekly)

bash
#!/bin/bash
set -euo pipefail

demyx_custom_weekly() {
    # Remove Docker build cache
    docker builder prune -f
}

demyx_custom_weekly "$@"

Activating

bash
# Copy example scripts
cp /demyx/custom/example-cron/daily.sh /demyx/custom/cron/daily.sh

# Edit with your logic
nano /demyx/custom/cron/daily.sh

# Make executable
chmod +x /demyx/custom/cron/daily.sh

Debugging

View cron output including custom script results:

bash
demyx log cron

Errors in custom scripts are logged but don't stop the rest of the cron from running.