Run script on every second sunday


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Run script on every second sunday
# 1  
Old 02-03-2011
Network Run script on every second sunday

I was to schedule a script in a crontab after every 15 days specically on every 2nd Sunday.

I know that i can schedule on basis of weekdays, but can it be done by skipping in between???Smilie
# 2  
Old 02-03-2011
write a ondition that if date between 6 and 14 and day = "sunday" then run the script.
use this command for day: date | awk '{ print $1 $2 $3 $5 }'
take date also..
then check condition.

this will help you..
regards
rajesh

Last edited by rajesh_pola; 02-03-2011 at 05:50 AM.. Reason: added one command
# 3  
Old 02-03-2011
Please post the next 6 example dates for your schedule.
This is to make it clear what you mean by "every 2nd Sunday".
On what date does (or did) the process first run?
# 4  
Old 02-07-2011
Error Every other sunday

I want to input the values in the crontab so that the script will only execute on alternate sundays.

Example if it ran on 6th which is a Sunday it should run on the 20th which is also a sunday but i am skipping 13th
# 5  
Old 02-07-2011
This is probably straightforward but not answering my post #3 completely and accurately does not help at all.
It's all about whether calendar month boundaries matter.
Just in case you have a weird implementation of the unix "date" command, please also post:
Operating System and version?
What Shell you prefer?

Last edited by methyl; 02-07-2011 at 09:59 PM..
# 6  
Old 02-07-2011
try this, and also you can modify the line5 and line8 to fit your requirement.

Code:
week=`date|awk '{print $1}'`
day=`date|awk '{print $3}'`
if [ $week == "Sun" ]
then
      if [ $day -lt 8 ] 
      then
      exec task
      elif [ $day -ge 15 ] && [ $day -lt 22 ]
      then
      exac task
      fi
fi

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

2. Shell Programming and Scripting

Run script on every last sunday of the month

Hi ALL, I have been testing this script to run for every last Sunday of the month,looks like month which have 5 sunday (july 2016 )is not passing this and failing every time. Here is what I am using, current_date=31 echo " CURRENT DAY -> $current_date" if ... (2 Replies)
Discussion started by: netdbaind
2 Replies

3. Shell Programming and Scripting

Trigger the script if it is first sunday of the quarterly month

Hello All, I have script which needs to be scheduled in crontab which needs to be run only on the first sunday of the quarterly months (March, June, September,Dec). Can anyone please help me out on this. Thanks, Arun. (13 Replies)
Discussion started by: Arun1992
13 Replies

4. UNIX for Dummies Questions & Answers

Script should check and run only on Sunday

Hi All, I have a script, I want to make sure the script should check whether the day is sunday, only then it should run, if it is run other days it should check and exit the script. Kindly help. Thanks in Advance !! (41 Replies)
Discussion started by: nanz143
41 Replies

5. Shell Programming and Scripting

Script fails to run properly when run from CRONTAB

Hello all, I'm trying to write a script to gather and send data and it works just fine at the bash command line, but when executing from CRON, it does not run properly. My scripting skills are pretty limited and there's probably a better way, but as I said it works at the command line, but... (12 Replies)
Discussion started by: rusman
12 Replies

6. Shell Programming and Scripting

Code to make sure Script runs only on sunday -

Hi I have written a script which restarts the application , I want to add a piece of code in my script , to make sure this gets executed only on sunday . So that even if someone runs it on any other day by mistake it should exit throwing an error message . Can someone please assist what will... (6 Replies)
Discussion started by: honey26
6 Replies

7. Shell Programming and Scripting

how to run an already made script run against a list of ip addresses solaris 8 question

how to run an already developed script run against a list of ip addresses solaris 8 question. the script goes away and check traffic information, for example check_GE-VLANStats-P3 1.1.1.1 and returns the results ok. how do I run this against an ip list? i.e a list of 30 ip addresses (26 Replies)
Discussion started by: llcooljatt
26 Replies

8. UNIX for Advanced & Expert Users

Autosys job run on Sunday

Hi, I need to create a autosys job which will run on every sunday at 7:30 AM NY time for each 10 min interval of time. days_of_week: su start_mins: 0,10,20,30,40,50 run_window:"07:30" Is it fine? Please help Thanks, Anup (2 Replies)
Discussion started by: anupdas
2 Replies

9. Shell Programming and Scripting

Crontab job to run every sunday

Hello, I wanted to run one of my shell script for every sunday at 5PM. Here is the crontab entry i am using.. 00 17 * * 0 /inventory/update.sh > /inventory/update.log 2>&1 The job is not kicking on sunday at the specified time.. Am i missing anthing? Any help is appreciated... (2 Replies)
Discussion started by: govindts
2 Replies
Login or Register to Ask a Question