Monitoring Maintenance Tasks
Maintenance tasks include log rotation, cache cleanup, temp file deletion, and other housekeeping scripts. When these fail silently, disk fills up, performance degrades, or systems eventually crash.
Configuration
Section titled “Configuration”Set your API key as an environment variable. For cron jobs, add it to your crontab:
# Edit crontabcrontab -e
# Add at top of crontabPAKYAS_API_KEY=pk_live_xxxxx
# Then your cleanup job0 4 * * * pakyas monitor cleanup-task -- /scripts/cleanup.shOr source from a file:
0 4 * * * . ~/.pakyas_env && pakyas monitor cleanup-task -- /scripts/cleanup.shSee Environment Variables for all options.
When to use this
Section titled “When to use this”- Maintenance runs on a schedule
- Skipped maintenance causes cascading problems
- Failures often go unnoticed until something breaks
Basic example
Section titled “Basic example”pakyas monitor cleanup-task -- ./cleanup.shPakyas wraps your maintenance script and alerts you immediately if it fails or doesn’t run.
Scheduler setup
Section titled “Scheduler setup”# crontab example - runs every day at 4am0 4 * * * pakyas monitor cleanup-task -- /scripts/cleanup.shWhat Pakyas detects
Section titled “What Pakyas detects”- Cleanup script exits non-zero
- Script runs longer than expected
- Script never runs (missed schedule)