Solving for the Last Day of the Month
10:24 PM
This script solves for the last day of the month.
It can be used as logic to determine if a script should be run.
Here is an example cron entry where we evaluate if it is the last day of the month everyday at 23:59 and if it is run the accept_instance_count.sh script.
#!/bin/bashTODAY=`/bin/date +%d`TOMORROW=`/bin/date +%d -d "1 day"`# See if tomorrow's day is less than today'sif [ $TOMORROW -lt $TODAY ]; then exit 0fiexit 1 |
Here is an example cron entry where we evaluate if it is the last day of the month everyday at 23:59 and if it is run the accept_instance_count.sh script.
59 23 * * * /home/accept/last-day-of-month.sh && /home/accept/accept_instance_count.sh
0 comments