diff options
Diffstat (limited to 'install/ishtar-delete-instance')
-rwxr-xr-x | install/ishtar-delete-instance | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/install/ishtar-delete-instance b/install/ishtar-delete-instance index a8b68b849..65aabe1c8 100755 --- a/install/ishtar-delete-instance +++ b/install/ishtar-delete-instance @@ -76,36 +76,47 @@ do_delete_instance() { exit 1 fi - sed '/'$to_delete'/d' $INSTANCES_FILE > /tmp/new_instances - mv /tmp/new_instances $INSTANCES_FILE - + systemctl stop uwsgi + systemctl stop monit || true INSTANCE=$to_delete rm -rf $ISHTAR_PATH/$INSTANCE rm -f "$NGINX_AVAILABLE_PATH/ishtar-$INSTANCE.conf" rm -f "$NGINX_ENABLE_PATH/ishtar-$INSTANCE.conf" rm -f "$UWSGI_AVAILABLE_PATH/ishtar-$INSTANCE.ini" rm -f "$UWSGI_ENABLE_PATH/ishtar-$INSTANCE.ini" + rm -f "/etc/monit/conf-available/celery-$INSTANCE" + rm -f "/etc/monit/conf-enabled/celery-$INSTANCE" + systemctl start uwsgi || true + systemctl start monit || true + + if [ $USE_CELERY = 'yes' ]; then + /usr/bin/supervisorctl stop celery_$INSTANCE || (true && cecho r "/usr/bin/supervisorctl stop celery_$INSTANCE - failed") + /usr/bin/supervisorctl remove celery_$INSTANCE || (true && cecho r "/usr/bin/supervisorctl remove celery_$INSTANCE - failed") + /usr/sbin/rabbitmqctl delete_vhost /ishtar$INSTANCE || (true && cecho r "/usr/sbin/rabbitmqctl delete_vhost /ishtar$INSTANCE - failed") + /usr/sbin/rabbitmqctl delete_user ishtar$INSTANCE || (true && cecho r "/usr/sbin/rabbitmqctl delete_user ishtar$INSTANCE - failed") + /usr/bin/supervisorctl reload || (true && cecho r "/usr/bin/supervisorctl reload - failed") + fi + + rm -f /etc/supervisor/conf.d/celery_$INSTANCE.conf DB_NAME="ishtar-$INSTANCE" export DB_NAME su postgres <<'EOF' - dropdb "$DB_NAME" - dropuser "$DB_NAME" + cd $HOME + dropdb "$DB_NAME" || (true && echo 'dropdb $DB_NAME - failed') + dropuser "$DB_NAME" || (true && echo 'dropuser $DB_NAME - failed') EOF - if [ $USE_CELERY = 'yes' ]; then - systemctl disable celery-$INSTANCE - systemctl stop celery-$INSTANCE - /usr/sbin/rabbitmqctl delete_vhost /ishtar$INSTANCE - /usr/sbin/rabbitmqctl delete_user ishtar$INSTANCE - rm "/etc/default/celeryd-"$INSTANCE - rm "/etc/systemd/system/celery-"$INSTANCE".service" - systemctl daemon-reload - fi + + sed '/'$to_delete'/d' $INSTANCES_FILE > /tmp/new_instances + mv /tmp/new_instances $INSTANCES_FILE echo "" - cecho g $to_delete" have been completly removed" + cecho g $to_delete" have been completely removed" echo "" } do_delete_instance +systemctl start uwsgi || true +systemctl start monit || true + |