Every Two Week Cron Job

Posted on 2005-03-24
Medium Priority
Last Modified: 2008-02-01
I need a cron that will run every other Monday ( without regard to the number of weeks in a month ).  I have tried:  0 4 * * mon/2  and that ran *every* Monday.

I'd like to avoid creating file - checking for existance of file - deleting file, etc. and just be able to specify the frequency in the crontab.

Any ideas?

Linux version 2.4.18-5 (root@localhost.localdomain) (gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98))
Question by:dskhunter
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 13624818
0 4 * * 1/2...This didn't work ?
0 is for sunday and 1 is for monday  

Author Comment

ID: 13625015
As I said, I used mon/2 and that ran every Monday.  I haven't tried 1/2 but I would expect the same results.

Expert Comment

ID: 13627427
I think that will work
LVL 38

Accepted Solution

wesly_chen earned 1200 total points
ID: 13635341
0 4 * * mon  script.sh

---script.sh ---

WK=`date +%W`
ON_WK=`expr $WK % 2`

if [ $ON_WK = 1 ]; then
  < your job here .... > 
Every Monday, the script.sh runs, but script.sh examines the date and continues only when it's running on an odd or even


Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question