#!/bin/bash echo "[Restore mongo] start" if [ "$#" -ne 1 ] then echo "You must pass the path of the backup file to restore" fi echo "=> Restore database from $1" set -o pipefail RESTORE_CMD="mongorestore --host ${MONGODB_HOST} --port ${MONGODB_PORT} -d ${MONGO_DB} $1" if ${RESTORE_CMD} then echo "=> Restore succeeded" else echo "=> Restore failed" fi echo "[Restore mongo] finish"