Cron Expression for Twice a Week
Run a cron job twice a week on Tuesday and Thursday at midnight using 0 0 * * 2,4. A moderate weekly frequency for semi-regular tasks.
Expression
0 0 * * 2,4 At 00:00 on Tuesday and Thursday
Use Cases
- • Running mid-week status checks
- • Sending bi-weekly digest emails
- • Processing data uploads on specific days
- • Running medium-frequency database optimization
Code Examples
Crontab
# At 00:00 on Tuesday and Thursday
0 0 * * 2,4 /path/to/your/script.sh GitHub Actions
name: Scheduled Job
on:
schedule:
- cron: '0 0 * * 2,4'
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "Running Twice a Week (Tue and Thu)" systemd Timer
[Unit]
Description=Twice a Week (Tue and Thu) timer
[Timer]
OnCalendar=*-*-* *:*:00
Persistent=true
[Install]
WantedBy=timers.target Tips
- ✓ Tuesday is 2 and Thursday is 4 in cron day-of-week
- ✓ Choose days that are evenly spaced for balanced workload
- ✓ Adjust the hour for business-friendly timing
- ✓ Common for tasks that are too frequent weekly but too infrequent daily
Frequently Asked Questions
How do I run a cron job on specific days of the week?
List the day numbers separated by commas in the day-of-week field: 0 0 * * 2,4 runs on Tuesday (2) and Thursday (4).
Can I run on Monday, Wednesday, and Friday?
Yes, use 0 0 * * 1,3,5 to run on those three days.