Permanently delete all orphan stores

From Zarafa wiki

Revision as of 12:35, 2 April 2010 by Msartor (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is a script which will permanently delete all currently orphaned stores. Might come in handy when you have a lot of orphan stores which need to be deleted.


Do the following:

  • Save the script to a file on your zarafa system.
  • chmod 755 [name_of_the_script]
  • run the script


The bash script:

#/bin/bash
#

ZARAFA_ADMIN=`which zarafa-admin`
AWK=`which awk`

echo 
echo "ALERT - This script will permanently delete all orphan stores!!!"
echo -n "Are you sure you want to continue [y/n]: "

read USERINPUT
echo

if [ "$USERINPUT" == "y" ]; then
  $ZARAFA_ADMIN --list-orphans | tail -n+4 | $AWK '{print $1}' |while read STOREID; do
    echo "Removing store: $STOREID"
    $ZARAFA_ADMIN --remove-store $STOREID
  done
else
  echo "Cancelled"
fi
Personal tools