summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2026-01-19 16:18:18 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2026-05-06 21:58:01 +0200
commit8acdf314d4640c2b737ad0496f6f0701219d8a9c (patch)
tree8aa27defcd673741c38f27926fedf82e09e845bc
parent557175913b15a3c201237ca5721882656d5cce9e (diff)
downloadIshtar-8acdf314d4640c2b737ad0496f6f0701219d8a9c.tar.bz2
Ishtar-8acdf314d4640c2b737ad0496f6f0701219d8a9c.zip
🚀 Debian package: python-django-ishtar - verify there is no import before restarting services
-rw-r--r--debian/python3-django-ishtar.postinst8
1 files changed, 7 insertions, 1 deletions
diff --git a/debian/python3-django-ishtar.postinst b/debian/python3-django-ishtar.postinst
index f892eaddd..bd10818e1 100644
--- a/debian/python3-django-ishtar.postinst
+++ b/debian/python3-django-ishtar.postinst
@@ -41,7 +41,7 @@ case "$1" in
instances="$( (cat $INSTANCES_FILE 2>/dev/null || true) | xargs )"
if [ -n "$instances" ]; then
if [ -f /usr/sbin/rabbitmqctl ]; then # assume queues are configured
- cecho c "Verify rabbitmq queues are empty"
+ cecho c "Verify rabbitmq queues are empty and no import is currently running"
for instance in $instances; do
for res in `rabbitmqctl list_queues -p /ishtar$instance -q messages`; do
if [ $res != 0 ] && [ $res != 'messages' ]; then
@@ -49,6 +49,12 @@ case "$1" in
cecho y "Wait a few minutes (hours?) for update."
exit 1
fi;
+ NB_IMPORT=$(sudo su - postgres -c "/usr/bin/psql -X -A -t -d ishtar-$instance -c \"SELECT count(id) FROM ishtar_common_import WHERE state IN ('IP', 'IQ')\"")
+ if [ $NB_IMPORT != '0' ]; then
+ cecho r "There are imports on $instance."
+ cecho y "Wait a few minutes (hours?) for update."
+ exit 1
+ fi;
done
done
fi