Here is a good tricky trick about the use of crontab in the end of month. First I wonder how the crontab should work. It could use date 1 but still it is not fun. I want the crontab in a single line, execute a program in 28 or 29 in February, or 30 at November or 31 at December.
Thanks to someone who wrote it in here.
The command in crontab is
59 23 28-31 * * [ "$(
date
+%d -d tomorrow)" = "01" ] && execute_this
Let’s wait to the end of month and see the crontab is working.
Leave a Reply