I think that you would need to run a script every sunday and determine how many days there are left in the current month. e.g using cal...
Code:
#!/usr/bin/ksh
set -A arr $(cal)
days_in_month=${arr[$((${#arr[*]}-1))]}
day_of_month=$(date +%d)
days_remaining=$((days_in_month-day_of_month))
if [[ $days_remaining -lt 7 ]]
then
echo run the script
else
echo not the last sunday
exit
fi
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.