HowTos/AdminScripts

From Scalix Wiki
Revision as of 13:50, 18 February 2007 by Dirk (Talk | contribs) (show the g-directory of a specific user)

Jump to: navigation, search

Here are some scripts that aren't big enough for a own topic.

show the g-directory of a specific user

Sometimes we have to know the g-directory of a mailbox. If you don't want to deal with omshowu every time you can use this script:

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 }' `
        echo $REALPATH$FOLDER
else
        echo "Can not find $1"
fi

As we are using the command "omshowu", we can use the same syntax to specify the username.

You can try to use the script like this:

cd `name_of_script "Givenname Surname"`

reset the imap-cache for a mailbox

A logical follow-up from the script above. With some early Scalix 11 versions it might necessary to reset the imap-cache.

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 "killing IMAP-processes for user $1 (uid $ID) ..."
     pkill -u $ID in.imap41d
     echo "locking mail-account ..."
     /opt/scalix/bin/ommodu -o "$1" -K
     echo "removing $REALPATH$FOLDER/imap-cache ..."
     rm -r  $REALPATH$FOLDER/imap-cache
     echo "unlocking mail-account ..."
     /opt/scalix/bin/ommodu -o "$1" -k
     echo "done!"
   fi
 else
   echo "Can not find $1"
 fi