Script execution

I need to call a script if the month end falls on Saturday or Sunday

Ok.

What code have you tried? Are you running the script in crontab?

No. i am not running the script in cron tab. Just if the month end falls on sat or sunday i need to run a script automatically. this should be done in shell scripting. i will create a autosys job for this and schedule it accordingly.

What is your system?

You need to check for two things, "month end" and "saturday or sunday". "Month end" is actually pretty difficult, since that's not predictable... Do you have GNU date? Or cal?

You could try a different approach, write a script that runs daily at a time that you manual execution is finished. If your execution can be marked somehow (by touching a file or something) then the script would be able to understand if it is a normal or off work day and act accordingly (it would work for holidays too...)

So, you say that you want to run it automatically. When would you want it running? Friday, the day that is the last day of the month, Monday following, or some other variation? How do you run it when the last day of the month is a Monday-Friday?

You could run the script each Friday (if that is what suits) and look forward to see if Sunday is the next month (i.e. Saturday is last-day-of-month), then check if Monday is next month (i.e. Sunday is last-day-of-month)

You can try to manipulate the TZ variable on some systems (AIX and others) to get differences to the actual clock so you can get forward or backward values to do your testing, perhaps use cal and read the current month calendar somehow or other ways.

BUT you haven't really nailed down the logic in what you want to do or how you plan to automate it.

Other questions that pop up are if the Friday is a National/Public/Bank Holiday. What would you want to do there?

Can you be more precise in your definition? We can look to options for helping you then.

Regards,
Robin