Cron Expression: January 1st at Midnight (0 0 1 1 *)
Need to generate a cron expression?
Use CronOS to generate any cron expression you wish with natural language. Simply describe what you need, and we'll create the perfect cron expression for you. It's completely free!
Cron Expression: January 1st at Midnight (0 0 1 1 *)
The cron expression 0 0 1 1 * executes a task on January 1st at midnight (00:00), making it ideal for yearly operations, new year tasks, and annual maintenance.
Expression Breakdown
0 0 1 1 *
│ │ │ │ │
│ │ │ │ └─── Day of week: * (every day)
│ │ │ └───── Month: 1 (January)
│ │ └─────── Day of month: 1 (first day)
│ └───────── Hour: 0 (at hour 0, midnight)
└─────────── Minute: 0 (at minute 0)
Field Values
| Field | Value | Meaning |
|---|---|---|
| Minute | 0 | At minute 0 |
| Hour | 0 | At hour 0 (midnight) |
| Day of Month | 1 | First day |
| Month | 1 | January |
| Day of Week | * | Every day of week (0-7) |
Execution Time
This expression runs once per year at:
- January 1st at 00:00 (midnight, New Year's Day)
Common Use Cases
1. Yearly Reports
0 0 1 1 * /usr/bin/python3 /scripts/generate-yearly-report.py
Generate annual reports or summaries for the previous year.
2. Yearly Backups
0 0 1 1 * /usr/local/bin/yearly-backup.sh
Create full yearly backups or archives.
3. Yearly Maintenance
0 0 1 1 * /usr/local/bin/yearly-maintenance.sh
Run annual system maintenance, cleanup, or optimization.
4. Data Archiving
0 0 1 1 * /usr/local/bin/archive-yearly-data.sh
Archive yearly data or move it to long-term storage.
5. License Renewal
0 0 1 1 * /usr/bin/python3 /scripts/process-license-renewals.py
Process annual license renewals or subscriptions.
Example Implementations
Yearly Report Script
# generate-yearly-report.py
import json
from datetime import datetime
import sqlite3
def generate_yearly_report():
conn = sqlite3.connect('/var/data/app.db')
cursor = conn.cursor()
# Get data from previous year
current_year = datetime.now().year
previous_year = current_year - 1
cursor.execute('''
SELECT
COUNT(*) as total_transactions,
SUM(amount) as total_revenue,
COUNT(DISTINCT user_id) as unique_customers,
AVG(amount) as avg_transaction_value
FROM transactions
WHERE YEAR(created_at) = ?
''', (previous_year,))
metrics = cursor.fetchone()
report = {
'year': previous_year,
'generated_at': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
'metrics': {
'total_transactions': metrics[0],
'total_revenue': round(metrics[1], 2) if metrics[1] else 0,
'unique_customers': metrics[2],
'avg_transaction_value': round(metrics[3], 2) if metrics[3] else 0
}
}
with open(f'/var/reports/yearly_{previous_year}.json', 'w') as f:
json.dump(report, f, indent=2)
print(f"{datetime.now()}: Yearly report generated for {previous_year}")
conn.close()
if __name__ == '__main__':
generate_yearly_report()
Best Practices
- New Year Timing: January 1st marks a clean yearly boundary
- Error Handling: Implement comprehensive error handling and logging
- Locking: Use file locks to prevent concurrent execution
- Monitoring: Set up alerts for failed yearly jobs
- Resource Management: Yearly jobs may be very heavy, monitor resources
When to Use
✅ Good for:
- Yearly reports
- Yearly backups
- Yearly maintenance
- Data archiving
- Annual operations
❌ Avoid for:
- Tasks requiring more frequent execution
- Real-time critical operations
Related Patterns
| Pattern | Expression | Description |
|---|---|---|
| January 1st | 0 0 1 1 * | New Year's Day |
| Quarterly | 0 0 1 1,4,7,10 * | First day of quarter |
| Every 6 months | 0 0 1 1,7 * | January and July |
Conclusion
The 0 0 1 1 * expression is perfect for yearly operations that should run on New Year's Day. It's commonly used for annual reports, backups, and maintenance tasks, providing a clean yearly cycle for recurring operations.
Need to generate a cron expression?
Use CronOS to generate any cron expression you wish with natural language. Simply describe what you need, and we'll create the perfect cron expression for you. It's completely free!