HowTos/AdminScripts
From Scalix Wiki
Revision as of 08:34, 25 April 2007 by Hydrospace (Talk | contribs) (→reset the imap-cache for a mailbox)
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 "killing UAL-remote processes for user $1 (uid $ID) ..." pkill -u $ID ual.remote echo "removing $REALPATH$FOLDER/imap-cache ..." rm -rf $REALPATH$FOLDER/imap-cache echo "removing $REALPATH$FOLDER/00008.ofs ..." rm -rf $REALPATH$FOLDER/00000v8.ofs echo "unlocking mail-account ..." echo -n "do you want to recreate the mailboxcache for $1 which can take a long time (y/N)" read DOIT2 if [ "$DOIT2" = "y" ] then echo "recreating mailboxcache for $1...." /opt/scalix/bin/sxmbcprep -B -u "$1" fi /opt/scalix/bin/ommodu -o "$1" -k echo "done!" fi else echo "Can not find $1" fi