From 7e846d875a829d19a26826608fe9f119e6cfcbd6 Mon Sep 17 00:00:00 2001 From: Ben Sturmfels Date: Sat, 25 Nov 2023 13:21:33 +1100 Subject: [PATCH] Add the conservancy-www-db.path Systemd file This runs the SQL update when the relevant file is modified. --- systemd/README.md | 11 ++++++----- systemd/conservancy-www-db.path | 9 +++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 systemd/conservancy-www-db.path diff --git a/systemd/README.md b/systemd/README.md index 01d81e5f..44c1fff0 100644 --- a/systemd/README.md +++ b/systemd/README.md @@ -1,8 +1,8 @@ -# SystemD services +# Systemd services ## Installing -Install all SystemD services with: +Install all Systemd services with: cp systemd/conservancy-www-*.{service,timer} /etc/systemd/system systemctl enable conservancy-www-cleanup.service @@ -10,6 +10,7 @@ Install all SystemD services with: systemctl enable conservancy-www-update.timer systemctl start conservancy-www-update.timer systemctl enable conservancy-www-db.service + systemctl start conservancy-www-db.path ## Website updates @@ -29,6 +30,6 @@ Note that the update script does not run `migrate`. ## Fundraiser/sustainer database updates -The `conservancy-www-db.service` applies SQL updates to the website -database. These include the fundraising total and sustainers to be publicly -acknowledged. +The `conservancy-www-db.service` applies SQL updates to the website database +automatically when the file `django-supporters-list.sql` file is modified. These +include the fundraising total and sustainers to be publicly acknowledged. diff --git a/systemd/conservancy-www-db.path b/systemd/conservancy-www-db.path new file mode 100644 index 00000000..a30e0681 --- /dev/null +++ b/systemd/conservancy-www-db.path @@ -0,0 +1,9 @@ +[Unit] +Description=Update Conservancy website database +Before=apache2.service + +[Path] +PathChanged=/home/debian/django-supporters-list.sql + +[Install] +WantedBy=apache2.service