tvdhout

crontab cheat sheet

May 27th, 2020
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.03 KB | None | 0 0
  1. # Thanks to Corey Schafer on Youtube
  2. # ┌───────────── minute (0 - 59)
  3. # │ ┌───────────── hour (0 - 23)
  4. # │ │ ┌───────────── day of month (1 - 31)
  5. # │ │ │ ┌───────────── month (1 - 12)
  6. # │ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday;
  7. # │ │ │ │ │                                       7 is also Sunday on some systems)
  8. # │ │ │ │ │
  9. # │ │ │ │ │
  10. # * * * * *  command_to_execute
  11.  
  12. # Every Monday at 10:30:
  13. 30 10 * * 1 echo "Hello" >> /tmp/test.txt
  14.  
  15. # On quarter past and quarter to every hour:
  16. 15,45 * * * * echo "Hello" >> /tmp/test.txt
  17.  
  18. # Every 10 minutes:
  19. */10 * * * * echo "Hello" >> /tmp/test.txt
  20.  
  21. # Every 3 days at midnight:
  22. 0 0 */3 * * echo "Hello" >> /tmp/test.txt
  23.  
  24. # Every hour from 5 to 10 am:
  25. 0 5-10 * * * echo "Hello" /tmp/test.txt
  26.  
  27. # Every 30 minutes during business hours:
  28. */30 9-17 * * 1-5 echo "Hello" /tmp/test.txt
Add Comment
Please, Sign In to add comment