Bird
0
0

You want to automate a task that runs every weekday at 9 AM but skips weekends. Which cron schedule line is correct?

hard📝 Application Q8 of 15
Linux CLI - Cron and Scheduling
You want to automate a task that runs every weekday at 9 AM but skips weekends. Which cron schedule line is correct?
A0 9 * * * /usr/bin/workday_task.sh
B0 9 * * 0,6 /usr/bin/workday_task.sh
C0 9 1-5 * * /usr/bin/workday_task.sh
D0 9 * * 1-5 /usr/bin/workday_task.sh
Step-by-Step Solution
Solution:
  1. Step 1: Understand weekday field meaning

    Weekday field 1-5 means Monday to Friday; 0 and 6 are Sunday and Saturday.
  2. Step 2: Match schedule to requirement

    0 9 * * 1-5 /usr/bin/workday_task.sh runs at 9 AM on weekdays only, skipping weekends.
  3. Final Answer:

    0 9 * * 1-5 /usr/bin/workday_task.sh -> Option D
  4. Quick Check:

    Weekdays = 1-5 in weekday field [OK]
Quick Trick: Use weekday 1-5 to run Monday to Friday [OK]
Common Mistakes:
  • Using 0,6 for weekdays instead of weekends
  • Using day of month instead of weekday
  • Running task every day unintentionally

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes