Skip to content

Commit

Permalink
feat: added systemd timers for notifications and syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
c0rydoras committed Oct 24, 2023
1 parent 5e0f63a commit e536708
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
api:
build: ./api
user: "${UID:?Set UID env variable to your user id}"
container_name: "outdated-api"
depends_on:
- db
ember:
Expand Down
9 changes: 9 additions & 0 deletions systemd/notifications.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Send email notifications to users
Wants=notifications.timer

[Service]
ExecStart=docker exec outdated-api sh -c './manage.py notify'

[Install]
WantedBy=multi-user.target
9 changes: 9 additions & 0 deletions systemd/notifications.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Send notifications every monday morning

[Timer]
Unit=notifications.service
OnCalendar=Mon *-*-* 00:00:00

[Install]
WantedBy=timers.target
9 changes: 9 additions & 0 deletions systemd/syncprojects.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Synchronise projects
Wants=syncprojects.timer

[Service]
ExecStart=docker exec outdated-api sh -c './manage.py syncprojects'

[Install]
WantedBy=multi-user.target
9 changes: 9 additions & 0 deletions systemd/syncprojects.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Send notifications every monday morning

[Timer]
Unit=syncprojects.service
OnCalendar=Mon *-*-* 00:00:00

[Install]
WantedBy=timers.target

0 comments on commit e536708

Please sign in to comment.