I have small check if today is first Monday of month which is like this:
['$(date "+%u")' = "1"] && echo 'trąba'
but I get the error when crontab is sending me an email that something went wrong
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
I tried changing '$(date "+%u")' to "$(date '+%u')" but didn't help. The title of the email is ["$(date '+ so I think it has a problem with 1st quote marks but this code works just fine when executed inside the terminal. Maybe someone have better "check" to check for the 1st Monday of month
OS: CeontOS 7
contab -l
* * * * * [ "$(date +%u)" -eq 1 ] && echo trąba
man
page, and it says "Note: The day of a command's execution can be specified by two fields — day of month, and day of week. If both fields are restricted (i.e., don't start with *), the command will be run when either field matches the current time." So I'll remove that part of my answer. – Gordon Davisson Jul 05 '21 at 06:21