diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-01-19 16:18:18 +0100 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-04-27 14:22:36 +0200 |
| commit | 721de73c40985458d94dfde0310cf654769efc8f (patch) | |
| tree | b107348aa5a17748a23b6f2e44d30f21b9b353c6 /debian | |
| parent | 23fac05a1ee3dd0a4ff72ae37928da73edcea6b3 (diff) | |
| download | Ishtar-721de73c40985458d94dfde0310cf654769efc8f.tar.bz2 Ishtar-721de73c40985458d94dfde0310cf654769efc8f.zip | |
🚀 Debian package: python-django-ishtar - verify there is no import before restarting services
Diffstat (limited to 'debian')
| -rw-r--r-- | debian/python3-django-ishtar.postinst | 8 |
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 |
