views:

148

answers:

2

E.g. the schellscript will not run on april 18, 19 and 20 and then for may is 16, 17 and 18 and so on

Thanks

A: 

You can get the weekday in numerical form from the date command using date "+%w". The output will be 0 for Sunday, 1 for Monday etc.

You can get the day of the month using date "+%d". Subtract one from that and divide by 7; that will give you how many complete weeks there have been in the current month.

From there, it's just a simple bunch of if/then statements. If you need more help actually implementing this, just ask.

Hope that helps!

BernzSed
A: 

I would advise to use cron for this kind of things, to separate the planned execution from what the script really does.

Have a look here on how to use cron.

Valentin Rocher