What you find on the Internet is positive thinking , I feel a little in trouble , and java Mostly , I am java Not good. , Not familiar with java Date calendar module , I have to find my own way
A script that is executed once a day , You need to send a message on the last Monday of each month
1.crontab There seems to be no such expression in ( Reference :https://zhuanlan.zhihu.com/p/38130334)
Not all of them , I only read what I needed , I don't know linux Different systems , still crontab Different versions , This deploy In my system (debian) It's a grammatical error
2. So you can only use python 了 , Judge for yourself in the script
Today's date is known , Reverse judgment
# Judge whether today is the last Monday of the current month
import datetime
import calendar
def isLastMonday():
# Get current year
year = datetime.date.today().year
# Get current month
month = datetime.date.today().month
today = datetime.date.today().day
dayOfWeek = datetime.datetime.now().weekday()
weekDay,monthCountDay = calendar.monthrange(year,month)
# Judge whether today is Monday (dayOfWeek=0)
# If you are judging whether it is the last Monday (+7, Is it greater than the last day )
if dayOfWeek == 0:
if today+7 > monthCountDay:
print " The last Monday "
return True
return False