Login or Register to Ask a Question and Join Our Community


Day_of_the_week


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Day_of_the_week
# 8  
Old 06-08-2011
If you run it in control-M, you should be able to run it in the desired time frame, without of taking care of the start time inside the script

You could just add at the beginning of your script :

Code:
[[ -f /tmp/flag/MAINTENANCE ]] && exit 1

And before beginning your maintenance :

Code:
touch /tmp/flag/MAINTENANCE

and remove that flag at the end of your maintenance

Otherwise, schedule it in Control-M and before starting your maintenance, freeze it / unschedule it temporary until you get finished with your maintenance.

I don't know Control-M but i am almost 100% sure such kind of scheduler has some option or other ways for calendar based schedule or time frame windows definition/exclusion, that would make possible to set up such a schedule constraints in one way or another.

I think you should investigate on Control-M possibilities at first since those sort of tools have been design to achieve exactly this kind of task.

Last edited by ctsgnb; 06-08-2011 at 02:56 PM..
# 9  
Old 06-10-2011
Thanks shell, I was able to accomodate your logic and it did work also. But, here I have one more condition to test a condition ,where I need not required to run this script on every thrid week between sat 23:00 pm hrs to 02:45 am sun. I would realy appriciate, if you could help to acheieve the same.

hare krishna
# 10  
Old 06-10-2011
Considering that a week starts on Sunday and if you have the first day of the month on a Saturday, it is already considered one week, then the Saturday of the third week should be between 15 and 21 of each month.

Having said that, if you do not want to run the script in the third week of the month, here is one possible solution:
Code:
typeset -i mDD=$(date +%d)
if [[ ${mDD} -ge 15 && ${mDD} -le 21 ]]; then
  echo "Third week of the month"
fi

# 11  
Old 06-13-2011
Hi Sehll,

Your solution worked like a charm. It really worked!. Also, I would really appriciate, if you could explain the purpose of following snippet.

Code:
typeset -i mHHMM=`date +%H%M`
typeset -i mDD=$(date +%d)
mDay=`date +%a`

hare krishna
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question

Featured Tech Videos