diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-01-19 16:18:18 +0100 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-03-23 10:07:42 +0100 |
| commit | 60df37d9a1b33ae5d4f2455651482e939fdd4ffe (patch) | |
| tree | 4ece19ae13a7a80a22970ebe1bb0c94716c2b30d | |
| parent | 7909c4571962a4161d812da2b61cb480e9b61d28 (diff) | |
| download | Ishtar-60df37d9a1b33ae5d4f2455651482e939fdd4ffe.tar.bz2 Ishtar-60df37d9a1b33ae5d4f2455651482e939fdd4ffe.zip | |
🚀 Debian package: python-django-ishtar - verify there is no import before restarting services
| -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 |
