• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to run a cron job on specific days of the week

by admin

Question: How to run a cronjob on a specific day of the week or a range of days of the week?

To run a cron job on specific days of the week, you can specify this via the following:

1. Edit the crontab for the user wishes to create the crontab job for. For example:

# crontab -e

Then add an entry specifying the date and time and day of the week you wish to run the crontab job on. For example:

This crontab entry runs the script at 17:00 (5PM) on Saturdays:

0 17 * * 6 /script/script.sh

This crontab entry runs the script at 17:00 (5PM) on Sunday through to Friday:

0 17 * * 0-5 /script/script.sh

2. There’s more detail on the different crontab options in the man pages, specifically:

# man 5 crontab

3. However, days of the week can be specified in the rightmost number in the above examples with values of 0 to 7 representing each day of the week and Sunday being able to specified by either 0 or 7.

Filed Under: Linux

Some more articles you might also be interested in …

  1. ionice Command Examples
  2. ac Command Examples in Linux
  3. physlock Command Examples in Linux
  4. terminator: command not found
  5. ifconfig Command Examples in Linux
  6. f3probe: Probe a block device (e.g. a flash drive or a microSD card) for counterfeit flash memory
  7. hn Command Examples
  8. CentOS / RHEL : How to collect sosreport
  9. git check-ignore: Analyze and debug Git ignore / exclude (“.gitignore”) files
  10. pactl: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright