All skills
Skillintermediate
/create-cron - Create Cron Job
Configure a cron job with proper scheduling and error handling.
Claude Code Knowledge Pack7/10/2026
Overview
/create-cron - Create Cron Job
Configure a cron job with proper scheduling and error handling.
Steps
- Ask the user for the task description and desired schedule
- Translate the schedule description to cron syntax (minute hour day month weekday)
- Show the next 5 execution times to verify the schedule is correct
- Create the cron job script with proper error handling and logging
- Add a lock mechanism to prevent overlapping executions
- Configure output redirection: stdout to log file, stderr to error log
- Add environment variable setup at the top of the cron script
- Set up email or webhook notification for job failures
- Add a health check: alert if the job has not run within expected interval
- Install the cron job using crontab or systemd timer
- Verify the job is listed in the cron table
- Document the job: purpose, schedule, log location, notification settings
Rules
- Always use absolute paths in cron scripts (PATH is minimal in cron)
- Set a timeout to kill hung jobs (use timeout command)
- Use file locking (flock) to prevent overlapping executions
- Redirect output to log files; do not rely on cron mail
- Include the full environment setup in the script (PATH, HOME, etc.)
- Add a comment line above each cron entry describing its purpose
- Test the cron script manually before installing it