#!/bin/bash

set -eEuo pipefail

link_path="/var/lib/redis"
dir_path="/ngcp-data/redis"

echo "Checking if there is a link '${link_path}'"
if [[ -L "${link_path}" ]]; then
  echo "Link '${link_path}' found, removing..."
  rm -f "${link_path}"
else
  echo "No link '${link_path}' found, nothing to remove"
fi

echo "Checking if there is a directory '${dir_path}'"
if [[ -d "${dir_path}" ]]; then
  echo "Directory '${dir_path}' found, removing..."
  rm -rf "${dir_path}"
else
  echo "No directory '${dir_path}' found, nothing to remove"
fi

echo "No redis leftovers on the system"
