Crontab running bi-weekly


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Crontab running bi-weekly
# 1  
Old 09-17-2012
Crontab running bi-weekly

Hi experts,

Need your help to schedule the script(test.sh) bi-weekly in linux machine.
script need to run at every alernate thursday at 9 am .
Please help to run the same.
# 2  
Old 09-17-2012
In crontab you can set day of month parameter (1 to 31). For example:
* * 4,18 * *
# 3  
Old 09-17-2012
Or every other week, regardless of the day of the month, example every other Thursday at 9:00pm:
Code:
0 19 * * 4  [ $(( $(( `date +%s` / 86400 / 7 )) % 2 )) -eq 1]  && /path/to/test.sh

Note: Please give us your OS and the shell you use to let us make sure this will work for you.
# 4  
Old 09-17-2012
Thanks Jim,
OS is redhat hat linux and shell is bash.
# 5  
Old 09-17-2012
Ought to work with a slight correction:

Code:
[ ... -eq 1 ]

# 6  
Old 09-18-2012
Thanks dear!!!!1
# 7  
Old 02-12-2013
What about every other week cronjob settings

I give start date to enddate like 21st January to 21st February on Every two week so How can I do that.
I had already done R&D for that but not succeed Please help me.

I tried out for Every other tuesday in following way but not success

10 11 18-28 1-2 2/2 script.sh

Thanks in advance.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Crontab is not loading/running

hi, i have crontab where i have put my db backup scripts but crontab do not run at specific time. i have checkted the scripts andwhen run the script as ./mydbbkp.sh so it successfully run and do the job but from cron it is not running whihcmeans cron is not running. i have an oracle user under... (3 Replies)
Discussion started by: janakors
3 Replies

2. UNIX for Dummies Questions & Answers

crontab not running script

Hi All, I am having the below script to be run from crontab, it it doesnt run. 1 * * * * /home/cobr_ext/test.sh > /home/cobr_ext/temp.txt when i run i manally it runs without any issues. Could please help me as to why doesnt it run the script.:( (7 Replies)
Discussion started by: abhi_123
7 Replies

3. Solaris

Please help why my Crontab is not running on time?

I have set up my cron job on the solaris SunOS 5.10 Generic_138888-03 sun4u sparc SUNW,UltraAX-i2 but it is not running on time as expected. Would you please help me to find out what I did wrong? I want to have this cron job run once every month on the 1st Wednesday of the month, but it ran... (6 Replies)
Discussion started by: ggcc
6 Replies

4. UNIX for Advanced & Expert Users

Particular script not running through crontab

Hi, I have created the below script, set -x # Set the Path of Environment file ENV_FILE_DIR=/opt/app/p1trp1c1/sybase/ecdwqdm/xrbid/QDM_Prod/bin LOG_DIR=/opt/app/p1trp1c1/sybase/ecdwqdm/xrbid/QDM_Prod/log export ENV_FILE_DIR export LOG_DIR # Set Audit Environment . ${ENV_FILE_DIR}/QDM.env... (8 Replies)
Discussion started by: yohasini
8 Replies

5. UNIX for Dummies Questions & Answers

Issue while running from crontab

Hi All, Here is my command which I've scheduled to be run from crontab, but it's giving error message: rah: rahhost executable needed but not in PATH My cmd is- 36 10 * * * /opt/IBM/dwe/db2/V9.5/bin/rah "df -m" >> /db2home/bculinux/Files/log/db.out 2>&1 Though I've added path... (5 Replies)
Discussion started by: NARESH1302
5 Replies

6. Shell Programming and Scripting

Crontab not running a script

Hi, I posted this in the Solaris forum but I think this one would be more appropriate. I created a script starting with the following lines: #!/usr/bin/ksh flag=n export flag typeset -i quant=0 (...) When running it I'm getting the following 2 errors: /tmp/tstscript/testfail.ksh:... (9 Replies)
Discussion started by: Cvg
9 Replies

7. Shell Programming and Scripting

Running SQLPLUS Script in CRONTAB

Hi, Can someone please help me here with this one. This is my script: # more tosh.sh #!/usr/bin/ksh clear . /home/oracle/.profile echo "Good morning, world." export ORACLE_HOME=/u01/app/oracle/product/9.0.1 export PATH=$ORACLE_HOME/bin:/usr/local/bin export ORACLE_SID=xxxx ... (11 Replies)
Discussion started by: santoshpayal
11 Replies

8. UNIX for Dummies Questions & Answers

crontab job not running

Hi all, down here part of the scheduled job in crontab (AIX Version 5) i have problem running jspPRE-ALL. i verrify permissions and privileges (the others job are working good) if i run the job in command line it work correctly # # Aggiornamento doni e continuity 00 02 * * 2-6... (5 Replies)
Discussion started by: ilpasta
5 Replies

9. UNIX for Advanced & Expert Users

Crontab is not running!!!

Hi experts, need your helpo. after editing the crontab while saving the file it says- "/tmp/crontabRlaauT" 1 line, 77 characters cron may not be running - call your system administrator And i checked after certain time. script in cron is not running. I got a mail in user saying... (1 Reply)
Discussion started by: thepurple
1 Replies

10. UNIX for Dummies Questions & Answers

running sql in crontab

Hi, i have a scripts that update an SQL DATABASE using sqlplus command. when i run it in a interactive mode its ok but when try to run it using the crontab i get an a messege : "Must be attached to terminal for 'am I' option" (there is no "who am i" command in the script) and the DB... (4 Replies)
Discussion started by: dorilevy
4 Replies
Login or Register to Ask a Question