Make sure thehive is up then soup

This commit is contained in:
TOoSmOotH
2020-12-16 17:23:51 -05:00
parent 384456a991
commit 23110d3b33

View File

@@ -342,9 +342,26 @@ space_check() {
} }
thehive_maint() { thehive_maint() {
echo -n "Waiting for TheHive..."
COUNT=0
THEHIVE_CONNECTED="no"
while [[ "$COUNT" -le 240 ]]; do
curl --output /dev/null --silent --head --fail -k "https://localhost/thehive"
if [ $? -eq 0 ]; then
THEHIVE_CONNECTED="yes"
echo "connected!"
break
else
((COUNT+=1))
sleep 1
echo -n "."
fi
done
if [ "$THEHIVE_CONNECTED" == "yes" ]; then
echo "Migrating thehive databases if needed." echo "Migrating thehive databases if needed."
curl -v -k -XPOST -L "https://localhost/thehive/api/maintenance/migrate" curl -v -k -XPOST -L "https://localhost/thehive/api/maintenance/migrate"
curl -v -k -XPOST -L "https://localhost/cortex/api/maintenance/migrate" curl -v -k -XPOST -L "https://localhost/cortex/api/maintenance/migrate"
fi
} }
unmount_update() { unmount_update() {