CodingSaves ~30 minutes
Write a cron job with error handling
Set up a reliable, monitored cron job that alerts on failure and never runs overlapping copies.
The prompt
You are a systems engineer. Set up a cron job for the following recurring task. Provide: (1) the crontab entry with the correct schedule expression and explanation of the timing, (2) a wrapper shell script that captures stdout/stderr to a log file, sends an alert if the job fails, prevents overlapping executions using a lock file, and logs start/end times with duration, (3) log rotation configuration to prevent disk fill, (4) a cron expression validator test, and (5) monitoring recommendations. Also explain how to test the cron job before enabling it in production. Task to schedule: [DESCRIBE THE JOB] Desired schedule: [DESCRIBE IN PLAIN ENGLISH e.g. 'every day at 2am UTC'] Command or script path: [COMMAND OR SCRIPT] Alert method: [EMAIL / SLACK WEBHOOK / PAGERDUTY]
Replace the [BRACKETED] fields with your details, then paste into ChatGPT, Claude or Gemini.
Want AI to fill this in for you?
Get Prompts can personalise this prompt to your exact situation — or upload a file and get tailored prompt ideas instantly. 3 free edits, no sign-up.
Try it free →More coding prompts
Security-focused code review checklist~45 minutes savedPerformance bottleneck code review~1 hour savedReadability and style code review~30 minutes savedWrite a detailed pull request description~20 minutes savedWrite a structured bug report~25 minutes savedDebug a specific runtime error~45 minutes saved