I have a cronjob that will be launched at the end of each month to generate a monthly report.
Here I found how to launch the job at the end of each month: Cron job to run on the last day of the month
Now, I just want the date of the last day of the month as an argument for the script.
For example:
compute_monthly_rate -e **2016.01.31**
How can I pass this date as an argument?
Most implementations of cron
pass a command string to /bin/sh
so depending on what it is on your system and what implementation of date
you have you may have luck with this:
compute_monthly_rate -e $(date +%Y.%m.%d)
Try it in a terminal first:
$ date +%Y.%m.%d
2016.02.02
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With