Skip to content

Commit 9f7b70e

Browse files
authored
Merge pull request #7 from kwhitehall/monthlyCron
fixed bugs in monthly update cron
2 parents a36d58c + d3ec060 commit 9f7b70e

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

automate/email-content.txt

100644100755
File mode changed.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22

33
# This script is for updating the meeting date every third Sunday
4-
# Add to crontab like so: 0 0 15-21 * * [`date+%a`==Sun]&&/path/to/meetingDate.sh
4+
# Add to crontab like so: 0 0 15-21 * * Sun /path/to/meetingDate.sh
55

66
todayYr=date+%Y
77
todayMth=date+%m
8-
/path/to/utils/cronscripts/updateDate.sh todayYr todayMth /path/to/git/clone/site
8+
/path/to/utils/cronscripts/updateDate.sh $todayYr $todayMth /path/to/git/clone/site

cronscripts/updateDate.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ else
129129
MonthCheck $2
130130
NY=$1
131131
NM=$2
132-
oldDay=`cal $2 $1| tail +5|cut -c19,20| sed -n 1p`
132+
oldDay=`cal $2 $1| tail -4|cut -c19,20| sed -n 1p`
133133
oldMthStr=$(MonthStr ${NM})
134134
oldDate="$oldMthStr $(LastDigit ${oldDay}), $NY"
135135
oldDay=$((oldDay-1))
@@ -144,7 +144,7 @@ else
144144
newMth="1"
145145
fi
146146

147-
newDay=`cal $newMth $newYr| tail +5|cut -c19,20| sed -n 1p`
147+
newDay=`cal $newMth $newYr| tail -4|cut -c19,20| sed -n 1p`
148148
newMthStr=$(MonthStr ${newMth})
149149
newDate="$newMthStr $(LastDigit ${newDay}), $newYr"
150150
saveDate="$newYr$newMth$newDay"
@@ -159,11 +159,9 @@ else
159159
git push origin
160160

161161
# update the email reminder
162-
$PWD/updateMonthlyEmails.sh email-content.txt "${oldDate}" "${newDate}"
162+
$PWD/updateMonthlyEmail.sh email-content.txt "${oldDate}" "${newDate}"
163163

164164
# write new date to file
165-
rm -f $PWD/nextDate.txt
166-
touch $PWD/nextDate.txt
167165
echo $saveDate > $PWD/nextDate.txt
168166

169167

0 commit comments

Comments
 (0)