I am doing an upgrade to 11.4.5 and need to clear imap cache for users and rebuild it to minimize login problems via SWA with people who have very large inboxes. I got this script from here and it works great for one user. How can the script be modified to run verbose, unattended for all scalix users?
Code: Select all
#!/bin/bash
if [ "$1" = "" ]
then
echo "usage: $0 username"
exit 1
fi
REALPATH=`/opt/scalix/bin/omrealpath "~/"`
OMSHOWU=`/opt/scalix/bin/omshowu -n "$1" -f 2>/dev/null| grep "User Folder"`
if [ $? -eq 0 ]
then
FOLDER=`echo $OMSHOWU | awk -F/ '{print $2 "/" $3 }' `
ID=`/opt/scalix/bin/omshowu -n "$1" | grep "System Login :" | awk -F: '{print $2}' `
echo -n "Do you really want to remove the imap-cache for $1 (y/N)"
read DOIT
if [ "$DOIT" = "y" ]
then
echo "locking mail-account ..."
/opt/scalix/bin/ommodu -o "$1" -K
echo "killing IMAP-processes for user $1 (uid $ID) ..."
pkill -u $ID in.imap41d
echo "removing $REALPATH$FOLDER/imap-cache ..."
rm -rf $REALPATH$FOLDER/imap-cache
echo -n "do you want to recreate the mailboxcache for $1 which can take a while (y/N)"
read DOIT2
if [ "$DOIT2" = "y" ]
then
echo "killing UAL-remote processes for user $1 (uid $ID) ..."
pkill -u $ID ual.remote
echo "removing $REALPATH$FOLDER/00000v8.ofs ..."
rm -rf $REALPATH$FOLDER/00000v8.ofs
echo "recreating mailboxcache for $1...."
/opt/scalix/bin/sxmbcprep -B -u "$1"
fi
omtidyu -B -M -u ' $1/sbgk'
echo "unlocking mail-account ..."
/opt/scalix/bin/ommodu -o "$1" -k
echo "done!"
fi
else
echo "Can not find $1"
fi