Skip to content

Commit

Permalink
Add cron job to send reminders abt pinned messages
Browse files Browse the repository at this point in the history
  • Loading branch information
WillNilges committed Nov 30, 2023
1 parent cb79e29 commit fe66e5f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ COPY --from=builder /build/cursed-status-page ./
COPY static/. ./static/
COPY templates/. ./templates/

# Install any necessary runtime dependencies
# Set up cron to send pin reminders daily
COPY crontab /etc/cron.d/send-reminders
RUN chmod 0644 /etc/cron.d/send-reminders; crontab /etc/cron.d/send-reminders; touch /var/log/cron.log

RUN apk add --no-cache tzdata

# Define the entry point
ENTRYPOINT ["./cursed-status-page"]
ENTRYPOINT crond && ./cursed-status-page

1 change: 1 addition & 0 deletions crontab
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0 17 * * * /cursed-status-page -send-reminders >> /var/log/cron.log 2>&1
2 changes: 1 addition & 1 deletion reminder.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func sendReminders() error {
}

// Send summary message
summaryMessage := fmt.Sprintln("<!here> Hello, Admins.\nThe following messages have been pinned for >1 day.")
summaryMessage := fmt.Sprintln("<!here> Hello, Admins.\nThe following messages are currently pinned to the status page.")
for _, m := range pinnedMessageLinks {
var parsedStatus string
if m.status == "" {
Expand Down

0 comments on commit fe66e5f

Please sign in to comment.