Patching on a specific date each month - how?

I am looking to setup an environment where our Staging and Dev servers are patched in the 2nd week of a month - lets say Thursday. Then 2 weeks later - again on Thursday, we patch production. This is security and app updates. We're using 18.04. I've seen so many suggestions on line and I can tell someone a dozen ways this doesn't work...! I'm still quite new with Linux and need some guidance on this.


Solution 1:

Run your cron job on every possible day, exit on non Thursdays, and put

if [[ "$(date "+%a")" != "Thu" ]] ; then
  exit
fi

near the top of the script.